Last active
June 14, 2020 10:51
-
-
Save irokhes/95105bc293483bd7a3bfe5b61fcea6b1 to your computer and use it in GitHub Desktop.
List of 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
# Get a local Shell of container | |
docker run -i -t --entrypoint /bin/bash imageID | |
# Create image using this directory's Dockerfile | |
docker build -t friendlyname . | |
# Run "friendlyname" mapping port 4000 to 80 | |
docker run -p 4000:80 friendlyname | |
# Same thing, but in detached mode | |
docker run -d -p 4000:80 friendlyname | |
# See a list of all running containers | |
docker ps | |
# Gracefully stop the specified container | |
docker stop <hash> | |
# See a list of all containers, even the ones not running | |
docker ps -a | |
# Force shutdown of the specified container | |
docker kill <hash> | |
# Remove the specified container from this machine | |
docker rm <hash> | |
# Remove all containers from this machine | |
docker rm $(docker ps -a -q) | |
# Show all images on this machine | |
docker images -a | |
# Remove the specified image from this machine | |
docker rmi <imagename> | |
# Remove all images from this machine | |
docker rmi $(docker images -q) | |
# Log in this CLI session using your Docker credentials | |
docker login | |
# Tag <image> for upload to registry | |
docker tag <image> username/repository:tag | |
# Upload tagged image to registry | |
docker push username/repository:tag | |
# Run image from a registry | |
docker run username/repository:tag |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment