# Create image using this directory's $ dockerfile
$ docker build -t friendlyhello .
# Run "friendlyhello" mapping port 4000 to 80
$ docker run -p 4000:80 friendlyhello
# Same thing, but in detached mode
$ docker run -d -p 4000:80 friendlyhello
# List all running containers
$ docker container ls
# List all containers, even those not running
$ docker container ls -a
# Gracefully stop the specified container
$ docker container stop <hash>
# Force shutdown of the specified container
$ docker container kill <hash>
# Remove specified container from this machine
$ docker container rm <hash>
# Remove all containers
$ docker container rm $($ docker container ls -a -q)
# List all images on this machine
$ docker image ls -a
# Remove specified image from this machine
$ docker image rm <image id>
# Remove all images from this machine
$ docker image rm $($ docker image ls -a -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
08 June 2019
Get Started with Docker Part 2
Cheat sheet copied from docker docs
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment