Skip to content

Latest commit

 

History

History
51 lines (31 loc) · 1.95 KB

File metadata and controls

51 lines (31 loc) · 1.95 KB
aliases
Concepts/Container Lifecycle
Container Lifecycle
tags
seedling
publish false

The container lifecycle describes the stages a container goes through—from image creation, initialization, running, pausing, stopping, and ultimately removal. All example code below user Docker as the runtime environment

Creation

docker create --name my-container my-image:latest

The container has been defined from an image and assigned resources but is not yet running. Docker (or another runtime) initializes the container metadata, filesystem, and environment.

Running

docker start or docker run (create and start at the same time)

The container is executing the application or command. To monitor running containers:

docker ps -a

Paused

docker pause my_container

The container process is temporarily suspended. To unpause a container:

docker unpause my_container

Exit

To manually stop/kill a container: docker kill my_container or docker stop my_container

The container has completed execution or has been manually stopped. Alternatively, you can use:

docker rm -f my_container to remove the container

Documentation for these command can be read at Dockerdocs - CLI commands

%% wiki footer: Please don't edit anything below this line %%

This note in GitHub

Edit In GitHub | Copy this note

Was this page helpful? 👍 or 👎