Cloud Computing
Docker
Subjective
Sep 30, 2025
Explain Docker container lifecycle and state management.
Detailed Explanation
Docker container lifecycle states: 1) Created: Container created but not started (docker create), 2) Running: Container is executing (docker start, docker run), 3) Paused: Container processes are paused (docker pause), 4) Stopped: Container has exited (docker stop), 5) Killed: Container forcefully terminated (docker kill), 6) Removed: Container deleted from system (docker rm). State transitions: docker create -> docker start -> Running, docker pause -> Paused -> docker unpause -> Running, docker stop -> Stopped -> docker start -> Running, docker kill -> Stopped, docker rm -> Removed. Management commands: docker ps (running containers), docker ps -a (all containers), docker logs (container output), docker inspect (detailed info), docker stats (resource usage). Best practices: Use health checks for automatic restart, Implement graceful shutdown handling, Monitor container states, Clean up stopped containers regularly with docker container prune.
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts