Skip to content

Instantly share code, notes, and snippets.

@mostafabahri
Last active December 16, 2017 08:09
Show Gist options
  • Save mostafabahri/4576c40bd867a608db6a4a1c5de029e7 to your computer and use it in GitHub Desktop.
Save mostafabahri/4576c40bd867a608db6a4a1c5de029e7 to your computer and use it in GitHub Desktop.
Docker Tips
# remove all stopped containers!
docker container prune
# show layers info about a a image
docker history <image>
If your container needs to write a lot of data, you should consider using a data volume.
# remove container when exited
docker run --rm <>
# run in background
docker run -d <>
# -t allocate a psudo-tty so no immediate exit( hence no stopped container)
docker run -d -t ubuntu
# remove dangling volumes( volumes attached to no current running container)
docker volume rm $(docker volume ls -f dangling=true -q)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment