How “docker stop” Works?
When you execute a docker stop command along with the container name or id, the docker on behind sends two single signals to the container before the termination. The first signal known as SIGTERM signal warns the container for possible termination after the default grace time of 10seconds it sends another signal known as SIGKILL signal that terminates the running container. The Flow of docker stop explain in steps as follows:
Step 1: Initiating Stop process by running command as follows:
docker stop <container_name or container_id>
Step 2: Docker sends SIGTERM signal to container.
Step 3: Graceful Shutdown (If possible): When the container receives the SIGTERM signal the main process of container starts cleaning of necessary tasks and closing connections.
Step 4: Timeout Period, By default timeout period 10seconds are provided, or else you can customize and set our time for the main process to clean the tasks.
Step 5: Send SIGKILL Signal (If Necessary), If the container is not able to respond with termination of the container within the specified time, docker sends SIGKILL signal to the container immediately.
Docker Stop Command |A Complete Tutorial:Defnition,Syntax,Examples
In the field of Docker container management, the docker stop command serves as a critical tool for mainly shut-down containers. This article talks about the working of the docker stop command, explaining its purpose, usage, and importance of proper container termination.
Contact Us