Docker tips

Some handy docker commands:

When you are connected to a docker container and would like to disconnect:

ctr-p followed by ctrl-q

To start a bash shell in a running container (you would need a recent version of docker for this):

docker exec -it containername bash

To show the logging of the service whichs runs inside a docker container:

docker logs -f containername

To remove all containers:

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

To remove all images
docker rmi $(docker images -q)

To remove all orphan volumes
docker volume rm $(docker volume ls -qf dangling=true)

Install the latest docker:

#install docker
curl -sSL | sudo sh

#install docker compose
curl -L`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose