Skip to content



  set -x; sudo apt-get update &&
  sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release &&
  DIST=$(lsb_release -is | tr '[:upper:]' '[:lower:]') &&
  ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(armhf\)\(64\)\?.*/\1\2hf/' -e 's/aarch64$/arm64/')" &&
  curl -fsSL "${DIST}/gpg" | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg &&
  echo "deb [arch=${ARCH} signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]${DIST} $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  sudo apt update &&
  sudo apt install -y docker-ce docker-ce-cli &&
  sudo usermod -aG docker $(whoami)

Test that sudo is not needed

docker run --rm hello-world


uname -m
# x86_64
docker run --rm -t arm64v8/ubuntu uname -m
# standard_init_linux.go:211: exec user process caused "exec format error"
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -t arm64v8/ubuntu uname -m
# aarch64


mkdir ~/.docker/cli-plugins
wget -O ~/.docker/cli-plugins/docker-buildx
chmod a+x ~/.docker/cli-plugins/docker-buildx
# Set buildx as default
docker buildx install
# Create builder
docker buildx create --name mybuilder
# Switch to the new builder
docker buildx use mybuilder
# Inspect it
docker buildx inspect --bootstrap

Prune all

docker system prune --all

ssh certs

curl --remote-name --time-cond cacert.pem


# Debian
docker exec -it <container name> /bin/bash
docker run -it --rm <image name> /bin/bash
# alpine
docker exec -it <container name> /bin/ash
docker run -it --rm alpine:3.13.1 <container name> /bin/ash

Stop all containers

docker container stop $(docker container ls -aq)

Remove all stopped containers

docker container rm $(docker container ls -aq)

To delete all containers including its volumes

docker rm -vf $(docker ps -a -q)

To delete all the images,

docker rmi -f $(docker images -a -q)

Remember, you should remove all the containers before removing all the images from which those containers were created.

Copy Multiple Files

COPY ["__BUILD_NUMBER", "", "gulpfile", "another_file", "./"]


sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose


$ brew install hadolint

Pull by Digest

docker run -it --rm python:[email protected]:482d4cc1ae3c95d0f4dd25005e22a17f22f693ca7fb07bb7870ff9354844f738 /bin/bash

Run on Current Directory

docker run --rm -it -v $(pwd):/charts --entrypoint "/bin/bash" -w /charts k8s-at-home/charts-unit-test -l -c "bundle exec m -r ./test/charts"

Check if Image Exists

docker inspect --type=image treeder/hello.rb:nada
Error: No such image: treeder/hello.rb:nada

Insecure Registries

sudo nano /etc/docker/daemon.json
  "insecure-registries" : [""]
  "insecure-registries" : [""]
  "insecure-registries" : [""]
  "insecure-registries" : [""]
  "insecure-registries" : [""]
  "insecure-registries" : [""]
  "insecure-registries" : [""]


Back to top