Junior — Middle
What happens to the internal state and files of a Docker container when its termination is activated?
sobes.tech AI
Answer from AI
When a Docker container stops (for example, the docker stop command or the process inside the container has finished), the following occurs:
- The internal state of the container (processes, memory) is halted.
- The container's filesystem remains unchanged in the state it was at the moment of stopping.
- The container transitions to the "Exited" state — it is not automatically deleted, and can be restarted or removed manually.
Important: Changes made inside the container during its operation are saved in the container's layer as long as the container exists. If the container is deleted, these changes are lost unless they were saved in volumes or external storage.
Thus, stopping a container halts its operation but does not delete its internal files and state unless the delete command is executed.