Skip to content

Instantly share code, notes, and snippets.

@karl-gustav
Last active June 14, 2021 10:09
Show Gist options
  • Save karl-gustav/8b1c343488fa7bae66faafc2e37db216 to your computer and use it in GitHub Desktop.
Save karl-gustav/8b1c343488fa7bae66faafc2e37db216 to your computer and use it in GitHub Desktop.
Usefull docker commands

Bash prompt inside running docker (try sh if no bash)

docker exec -it $(docker ps -q) bash

Bash prompt inside new docker (try sh if no bash)

docker run -it ubunut bash

Kill all running containers with

docker kill $(docker ps -q)

Delete all stopped containers with

docker rm $(docker ps -a -q)

Delete all images with

docker rmi $(docker images -q)

Remove all unused images not just dangling ones

docker system prune -af
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment