Home · RSS · E-Mail · GitHub · GitLab · Twitter

Some helpful Docker bits

Updated 2021-06-12: Added --all --volumes --force args to docker system prune and removed separate commands for removing all images and volumes.

» Shell into a fresh container

Handy for some quick testing.

» Debian

1
docker run -it debian /bin/bash

» Alpine

1
docker run -it alpine /bin/ash

» Hostname of the host

When you are inside a docker container, you can use host.docker.internal for connections to the host machine.

» Stop all running containers

1
docker stop $(docker ps -q)

» Remove containers

» Remove all stopped containers

1
docker rm $(docker ps -aq)

» Remove all stopped and running containers

1
docker rm -f $(docker ps -aq)

» Docker System Prune

Clean up your host and free some space.

1
docker system prune --all --volumes --force

Home · RSS · E-Mail · GitHub · GitLab · Twitter