Bootstrap FreeKB - Docker - Stop a container using the docker stop command
Docker - Stop a container using the docker stop command

Updated:   |  Docker articles

Before using the docker stop command can be used to stop a container, you will probably want to use the docker ps command to determine if the container is running. In this example, the bar container has been running for 12 hours.

~]# docker ps -a
CONTAINER ID   IMAGE         COMMAND                  CREATED        STATUS                    PORTS     NAMES
d7bf9e534d50   foo           "/docker-entrypoint.…"   12 hours ago   Up 12 hours               80/tcp    bar

 

A Docker image contains the code used to create a Docker container, such as creating a Nginx web server, or a mySQL server, or a home grown app, and the list goes on. In this way, an image is like a template used to create a container. An image is kind of like a virtual machine, but much more light weight, using significantly less storage a memory (containers are usually megabytes in size).

The docker stop command with the container name can be used.

docker stop bar

 

Or with the container ID.

docker stop d7bf9e534d50

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 3513c5 in the box below so that we can be sure you are a human.