Skip to content

Instantly share code, notes, and snippets.

@tomasdev
Last active December 4, 2022 22:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomasdev/4f6d3abf7e5485a53308e758ad04c67d to your computer and use it in GitHub Desktop.
Save tomasdev/4f6d3abf7e5485a53308e758ad04c67d to your computer and use it in GitHub Desktop.
Useful Docker commands
# Cheat sheet at https://dockerlabs.collabnix.com/docker/cheatsheet/
# Creates a Docker image on the current directory (must have a Dockerfile)
docker build -t $IMAGE_NAME .
# Run the recently built image
docker run $IMAGE_NAME
# Deletes all containers and all images
docker container prune && docker image prune -a
# List all containers, including those stopped
docker ps -a
# "Fork" the given container and ssh to it
docker commit $CONTAINER_ID user/test_image && docker run -ti --entrypoint=bash user/test_image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment