CLI tool for spawning and running containers according to the OCI specification.
The shim allows for daemonless containers. It basically sits as the parent of the container's process to facilitate a few things.
First it allows the runtimes(i.e. runc) to exit after it starts the container. This way we don't have to have the long running runtime processes
for containers. When you start mysql you should only see the mysql process and the shim.
Second it keeps the STDIO and other fds open for the container incase containerd and/or docker both die. If the shim was not running then the
parent side of the pipes or the TTY master would be closed and the container would exit.
Finally it allows the container's exit status to be reported back to a higher level tool like docker without having the be the actual parent of the
container's process and do a wait4.
containerd was introduced in Docker 1.11 and since then took main responsibility of managing containers life-cycle. containerd is the executor
for containers, but has a wider scope than just executing containers. So it also take care of:
Image push and pull
Managing of storage
Of course executing of Containers by calling runc with the right parameters to run containers...
Managing of network primitives for interfaces
Management of network namespaces containers to join existing namespaces
The Docker daemon - dockerd listens for Docker API requests and manages host's Container life-cycles by utilizing containerd.
dockerd can listen for Docker Engine API requests via three different types of Socket: unix, tcp, and fd.
By default, a unix domain socket is created at /var/run/docker.sock, requiring either root permission, or docker group membership.
On Systemd based systems, you can communicate with the daemon via Systemd socket activation,
use dockerd -H fd://.
❯ docker --version Docker version 20.10.5, build 55c4c88
❯ sudo docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 05ebb62bc655 nginx "/docker-entrypoint.…" 13 days ago Up 13 days 80/tcp nginx2 7f3fa77ddad8 nginx "/docker-entrypoint.…" 13 days ago Up 13 days 80/tcp nginx1
❯ docker --version Docker version 19.03.15, build 99e3ed8919
❯ docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES cbb233ea0045 nginx "/docker-entrypoint.…" 11 minutes ago Up 11 minutes 80/tcp nginx2 fa3468d6e89a nginx "/docker-entrypoint.…" 11 minutes ago Up 11 minutes 80/tcp nginx1
❯ podman version Version: 2.2.1 API Version: 2 Go Version: go1.14.12 Built: Mon Feb 22 12:51:35 2021 OS/Arch: linux/amd64
❯ podman container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 2fed78dd707e docker.io/library/nginx:latest nginx -g daemon o... 2 minutes ago Up 2 minutes ago nginx2 75103237f3d5 docker.io/library/nginx:latest nginx -g daemon o... 2 minutes ago Up 2 minutes ago nginx1
❯ runc list ID PID STATUS BUNDLE CREATED OWNER 2fed78dd707e865d4995f2d80dd9ee7830776e8adfe62f2b5b2754fa8b950be9 188922 running /var/lib/containers/storage/overlay-containers/2fed78dd707e865d4995f2d80dd9ee7830776e8adfe62f2b5b2754fa8b950be9/userdata 2021-03-31T06:36:31.164181537Z root 75103237f3d5f8d78f1d34cd32747c083f8d59eb5df4d09e3e68ab8279fcf832 188806 running /var/lib/containers/storage/overlay-containers/75103237f3d5f8d78f1d34cd32747c083f8d59eb5df4d09e3e68ab8279fcf832/userdata 2021-03-31T06:36:25.812499602Z root