How to stop a running container?

098

To stop a running Docker container, you can use the docker stop command followed by the name or ID of the container. Here’s the syntax:

docker stop <container_name_or_id>

For example, if your container is named my-nginx, you would run:

docker stop my-nginx

Alternatively, if you have the container ID, you can use that instead:

docker stop <container_id>

After executing this command, the specified container will be stopped. You can verify its status by running:

docker ps -a

This will show you a list of all containers, including those that are stopped.

0 Comments

no data
Be the first to share your comment!