Last active
December 4, 2022 22:50
-
-
Save tomasdev/4f6d3abf7e5485a53308e758ad04c67d to your computer and use it in GitHub Desktop.
Useful Docker commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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