Cheat Sheet - Docker

Cheat Sheet - Docker


sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli docker-compose-plugin

Add your user to the Docker group:

sudo usermod -aG docker $USER

Activate changes:

newgrp docker
Build full logs
docker build --progress=plain --no-cache ..

Docker Registry

To list private Docker registry images you can open the following link:

Install Docker Compose

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

Autocompletion for docker-compose:

sudo curl -L -o /etc/bash_completion.d/docker-compose

Remove all images

docker rmi $(docker images -q) -f

Remove unused images

docker images -q |xargs docker rmi

Stop all containers

docker stop $(docker ps -aq)

Remove all containers

docker rm $(docker ps -aq)

System cleanup

docker system prune -a -f

Copy the file from the container

If you need to copy a file from a running container you can use the docker cp command:

docker cp container_name:/path/to/file /dest/to/file