Stop, Start, And Resart Containers
In real-time we need to perform some upgrades or any other modifications to the containers then we can perform upgrades while the container is running but it is not good practice to do then in that time we will stop the container and perform our patches. For stopping the container we can we below command.
docker stop <ContainerName/container id>
After completing our maintenance to the containers know we need to start the container again so that end users can access our application for that we can use the following command.
docker start <ContainerName/Container ID>
In some conditions, like when we change the container port in a scenario we need to restart our containers and sometimes the container will have trouble we have performed an upgrade in the running container so in that time we need to restart the containers. By using the following command we can restart our container.
docker restart <ContainerName/Container ID>
How to Map Ports in Docker?
In docker, all the application in the container runs on particular ports when you run a container. If you want to access the particular application with the help of a port number you need to map the port number of the container with the port number of the docker host.