Starting a New Container
Understand how to start a new container using the Docker CLI and explore how Docker Engine components like containerd and runc work together to create and manage containers efficiently. Discover the role of shims and the daemon in running containers and why daemonless containers enhance flexibility.
Now that you have an overview, let’s see how to use Docker to create a new container.
Starting containers using the Docker CLI
The most common way of starting containers is using the Docker CLI. Run the following command to start a new container called ctr1 based on the nginx image.
docker run -d --name ctr1 nginx
Run a docker ps command to see if the container is running.
$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES9cfb0c9aacb2 nginx "/docker-entrypoint.…" 9 seconds ago Up 9 seconds 80/tcp ctr1
When you run commands like this, the Docker client converts them into API requests and sends them to the API exposed by the daemon. The daemon can expose the API on a local socket or over the network. On Linux, the local socket is /var/run/docker.sock and on Windows it’s \pipe\docker_engine.
The daemon receives the ...