From 6779aed327661e52488bef909b806a679884cc7f Mon Sep 17 00:00:00 2001 From: Gwendolynne Barr <31074572+gbarr01@users.noreply.github.com> Date: Tue, 22 Aug 2017 16:37:51 -0700 Subject: [PATCH] Update docker commands (#4291) --- get-started/part2.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/get-started/part2.md b/get-started/part2.md index 93574ca592..66ffb43b85 100644 --- a/get-started/part2.md +++ b/get-started/part2.md @@ -213,11 +213,11 @@ docker run -d -p 4000:80 friendlyhello You get the long container ID for your app and then are kicked back to your terminal. Your container is running in the background. You can also see the -abbreviated container ID with `docker ps` (and both work interchangeably when +abbreviated container ID with `docker container ls` (and both work interchangeably when running commands): ```shell -$ docker ps +$ docker container ls CONTAINER ID IMAGE COMMAND CREATED 1fa4ab2cf395 friendlyhello "python app.py" 28 seconds ago ``` @@ -317,6 +317,10 @@ docker run -p 4000:80 username/repository:tag If the image isn't available locally on the machine, Docker will pull it from the repository. +```shell +docker image rm +``` + ```shell $ docker run -p 4000:80 john/get-started:part1 Unable to find image 'john/get-started:part1' locally @@ -367,15 +371,15 @@ ones if you'd like to explore a bit before moving on. docker build -t friendlyname . # Create image using this directory's Dockerfile docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80 docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode -docker ps # See a list of all running containers -docker stop # Gracefully stop the specified container -docker ps -a # See a list of all containers, even the ones not running -docker kill # Force shutdown of the specified container -docker rm # Remove the specified container from this machine -docker rm $(docker ps -a -q) # Remove all containers from this machine -docker images -a # Show all images on this machine -docker rmi # Remove the specified image from this machine -docker rmi $(docker images -q) # Remove all images from this machine +docker container ls # List all running containers +docker container ls -a # List all containers, even those not running +docker container stop # Gracefully stop the specified container +docker container kill # Force shutdown of the specified container +docker container rm # Remove specified container from this machine +docker container rm $(docker container ls -a -q) # Remove all containers +docker image ls -a # List all images on this machine +docker image rm # Remove specified image from this machine +docker image rm $(docker image ls -a -q) # Remove all images from this machine docker login # Log in this CLI session using your Docker credentials docker tag username/repository:tag # Tag for upload to registry docker push username/repository:tag # Upload tagged image to registry