Skip to content

Instantly share code, notes, and snippets.

@odellt
Last active January 6, 2020 10:58
Show Gist options
  • Save odellt/450c5738d091e5f2a47cc07ceab2545a to your computer and use it in GitHub Desktop.
Save odellt/450c5738d091e5f2a47cc07ceab2545a to your computer and use it in GitHub Desktop.
Helper commands for docker management
#! bin/sh
# Docker Helpers
# List all containers by ID
docker ps -aq
# Stops all docker containers
docker stop $(docker ps -aq)
# Remove all containers
docker rm $(docker ps -aq)
# Remove all images
docker rmi $(docker images -q) --force
# Removes all unused images and volume
docker system prune --all --volumes --force
# Opens a shell inside a running docker container
docker exec -it [DOCKER CONTAINER NAME] /bin/sh
# Builds an image using the DockerFile in the current directory
docker build -t [DESIRED CONTAINER NAME] .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment