When working with Docker containers, it is useful to know how to start, stop, and restart the container via command line manually. This tutorial demonstrates how to do that.
Stop container
The docker stop
command, or docker container
command with stop
argument, can be used to stop a container. The command accepts container name or ID. For example, to stop container named nginx
, you can use:
docker stop nginx
docker container stop nginx
Start container
To start a stopped container, use the docker start
command, or docker container
command with start
argument.
docker start nginx
docker container start nginx
Restart container
Docker container can be restarted as follows:
docker restart nginx
docker container restart nginx
Leave a Comment
Cancel reply