Created
December 23, 2020 13:49
-
-
Save debdutgoswami/86589fbd60cef00c893f21e2e3fc8e84 to your computer and use it in GitHub Desktop.
One Place for all commonly used docker commands
This file contains hidden or 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
# build an image | |
docker build . | |
# build docker image with a tag (recommended) | |
docker build -t <tag> . | |
# run an image | |
docker run <image/tag> | |
# run an image in background | |
docker run -d <image/tag> | |
# run with port exposed | |
docker run -i -p 8080:8080 <image/tag> | |
# run with port exposed and running in background | |
docker run -i -p 8080:8080 -d <image/tag> | |
# docker images | |
docker images -a | |
# stop running containers | |
docker stop <image/tag> | |
# remove images | |
docker rmi <image/tag> | |
# remove all images | |
docker rmi $(docker images -a -q) | |
# remove all stoped containers | |
docker container prune |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment