-
Notifications
You must be signed in to change notification settings - Fork 8.4k
engine/daemon: Document embedded containerd mode #25658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vvoland
wants to merge
1
commit into
docker:main
Choose a base branch
from
vvoland:containerd-embedded
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| --- | ||
| title: Run containerd in the Docker daemon | ||
| linkTitle: Embedded containerd | ||
| description: Configure Docker Engine to run an experimental containerd server in the Docker daemon process | ||
| keywords: docker, daemon, dockerd, containerd, configuration, experimental | ||
| weight: 35 | ||
| params: | ||
| sidebar: | ||
| badge: | ||
| color: blue | ||
| text: Experimental | ||
| --- | ||
|
vvoland marked this conversation as resolved.
|
||
|
|
||
| Starting with Docker Engine 29.7.0, the Docker daemon can run containerd in | ||
| the same process as `dockerd`. By default, the daemon starts and manages | ||
| containerd as a separate process. | ||
|
|
||
| > [!CAUTION] | ||
| > | ||
| > Embedded containerd is an experimental feature. Its behavior may change, or | ||
| > the feature may be removed from a future release. | ||
|
|
||
| Embedded mode changes how the daemon starts and communicates with containerd. | ||
| The embedded server still listens on a containerd socket, but the daemon and | ||
| BuildKit reach it over an in-memory connection instead. Task shims continue to | ||
| run as separate processes and connect over a socket. | ||
|
|
||
| The performance benefit is greatest when Docker uses the containerd image | ||
| store. | ||
| Any image interactions use containerd's content API for both metadata requests | ||
| and the bytes that make up image manifests, configurations, and layers. | ||
| A separate containerd process splits these reads and writes into gRPC messages | ||
| that cross a Unix socket or named pipe. | ||
| Embedded mode sends the same messages over an in-memory connection, avoiding | ||
| operating system socket calls and kernel transport for this data-heavy path. | ||
|
|
||
| The embedded server doesn't include the container runtime interface (CRI). | ||
| You can't enable `embedded-containerd` and `cri-containerd` at the same time. | ||
|
|
||
| ## Enable embedded containerd | ||
|
|
||
| Add the `embedded-containerd` feature to the | ||
| [daemon configuration file](./_index.md#configuration-file): | ||
|
|
||
| ```json | ||
| { | ||
| "features": { | ||
| "embedded-containerd": true | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Restart the Docker daemon: | ||
|
|
||
| ```console | ||
| $ sudo systemctl restart docker | ||
| ``` | ||
|
|
||
| The `embedded-containerd` feature takes precedence over a containerd address | ||
| set with the `--containerd` daemon flag. This behavior means that packaged | ||
| service configurations that set a containerd address don't prevent embedded | ||
| containerd from starting. | ||
|
|
||
| > [!IMPORTANT] | ||
| > | ||
| > Embedded containerd keeps its state under the Docker data root, in | ||
| > `/var/lib/docker/containerd/daemon` by default. A containerd installed on the | ||
| > host keeps its own state elsewhere, such as `/var/lib/containerd`. If the | ||
| > daemon used such a containerd before, the containers and images stored there | ||
| > aren't available in embedded mode. | ||
|
|
||
| You can also enable the feature when starting `dockerd` manually: | ||
|
|
||
| ```console | ||
| $ sudo dockerd --feature embedded-containerd | ||
| ``` | ||
|
|
||
| ## Verify the configuration | ||
|
|
||
| Run `docker info` and check for the experimental mode warning: | ||
|
|
||
| ```console | ||
| $ docker info | ||
| ... | ||
| WARNING: Running with experimental embedded-containerd mode. This feature may change or be removed in a future release. | ||
| ``` | ||
|
|
||
| ## Connect directly to embedded containerd | ||
|
|
||
| The embedded server provides an endpoint for containerd clients such as | ||
| `ctr` and `nerdctl`. On Linux, the endpoint is | ||
| `<exec-root>/containerd/containerd.sock`. With the default daemon | ||
| configuration, this path is: | ||
|
|
||
| ```text | ||
| /var/run/docker/containerd/containerd.sock | ||
| ``` | ||
|
|
||
| On Windows, the server uses a named pipe by default. Check the Docker daemon startup logs | ||
| for the endpoint address. | ||
|
|
||
| Docker Engine stores containers in the `moby` containerd namespace by | ||
| default. For example, use `ctr` on Linux to list them: | ||
|
|
||
| ```console | ||
| $ sudo ctr --address /var/run/docker/containerd/containerd.sock \ | ||
| --namespace moby containers list | ||
| ``` | ||
|
|
||
| > [!WARNING] | ||
| > | ||
| > The endpoint is useful for debugging, but the daemon owns the state behind | ||
| > it. Don't treat it as a general-purpose containerd endpoint: its address and | ||
| > the layout of the namespaces can change, and changes that other clients make | ||
| > can conflict with the daemon. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still thinking it we should name the feature
builtin, but I guess we can still change.