-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
When using containerd snapshotter docker daemon doesn't check for "Already Exists" #46990
Comments
Quick "off-the-bat" reply to the second part of your description;
For transparency; the current implementation of the containerd image-store integration is largely written with the assumption that the "moby" namespace(s) are "owned" by the docker engine, and not manipulated separately. We're aware that this is not ideal, and have discussed making this more permissive in future (to allow for scenarios where multiple tools act on the same namespace), but it's not been our focus of attention for the initial implementation. As you mentioned, currently some state is kept in the Docker Engine itself; there is some synchronisation (e.g. container state), but there's likely many scenarios where this currently won't work well with other tools managing the data. Perhaps it would be good to create a separate ticket for this with further details so that it can be tracked and discussed separately. (if "making this work" would require limited changes, then contributions on improving would be welcome though!) |
Thanks for reporting; (also at a quick glance), that seems like an ok change to make. For handling these error-types, we should have a look to either handle that error immediately, and handle containerd's error-type (errdefs.ErrAlreadyExists) Or if we need to handle it further "up the stack", see if there's a suitable parallel in Moby's "errdefs" (although I don't think there's s direct 1:1 equivalent; Line 1 in 46f7ab8
@nealef As you already dug into the code, are you interested in contributing? |
I was looking at something like:
|
I'll create a separate ticket and continue to look at the I also wonder whether |
Hm.. wondering if perhaps that check should live somewhere in
I haven't looked into those details yet, but know that plans are to move more functionality to containerd code where possible. That said, there's been quite some handling specific to moby that had to be accounted for, and not all features required to handle that was available (yet) in containerd's code. |
It looks like this mostly because we want the switch to the containerd image store to be as transparent as possible and not break anyone, which means we have to reimplement everything the same way it already works. And sometimes the containerd API just doesn't have what we need (reference counting the mounts for example). |
As for the pulled image not being listed, could you restart dockerd with debug logging enabled and give us the logs after you run |
That's all there is in the dockerd log. Running an
|
Strace on the cli won’t get you any useful information no, the daemon is the one doing all the work. Not having any logs when image list is called is helpful though, we’ll take a closer look. If we don’t find anything, would you mind helping us debug this issue? I understand your code is proprietary for now but if we gave you a patch with some extra logs in the daemon would that work for you? |
I am attempting to instrument |
The following test is failed by the cached image:
This looks like my content store problem. This layer should exist in content store. It exists in my cache so when the content store server calls my content store's |
It appears that when an image doesn't exist we do the pull and then a commit. It is during the commit that the content store's I am seeing |
Also, you are using the |
What I believe is happening is that during the pull when it decides whether to pull in a diff it checks the snapshot area for a corresponding diff (for the 1st layer) or chainid (for subsequent layers), if it finds it (via the So this is not a problem with docker but the way containerd works. However, does docker need to do the manifest check before it will return details of the image? Could it do the same check(s) it does for As an experiment I commented out the |
Description
When using the containerd snapshotter interface the
daemon/create.go
code calls thePrepareSnapshotter()
function which in turn invokes the containerdPrepare()
API. It is possible to get a non-nilerr
value returned which is not a true error. That is, the snapshotter is able to returnErrAlrExists
(already exists) to tell containerd that the snapshot has been prepared. In our case we have a caching snapshotter that has prepared snapshots in advance.I note the code in
daemon/create.go
doesn't differentiate a "bad" err value from a "good" one:I am also seeing
docker images
does not report the newly pulled image for images in our content store. The way our content store works is that when containerd calls theInfo()
we check our cache and if it exists we symlink the cache entry into the content store and tell the caller the layer exists otherwise it goes through normal pull processing. So I am assuming that the docker pull is seeing a layer exists and just ignores the rest of the processing such that its own internal db is not fully updated. I say fully as whiledocker image
doesn't show the image adocker run
is fine.In the following console log I pull an image that's in our cache (we have both a content store plugin and snapshotter plugin) and one that's not in our cache. I am able to run the cached image but
docker images
doesn't report it:Reproduce
I am able to reproduce it on my system where our content store and snapshotter plugins reside but these are not public code (yet).
Expected behavior
docker images
should display images that are pulled when the snapshotter reports "Already Exists".docker version
Client: Docker Engine - Community Version: 24.0.2 API version: 1.43 Go version: go1.20.4 Git commit: cb74dfc Built: Thu May 25 21:53:10 2023 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 24.0.2 API version: 1.43 (minimum version 1.12) Go version: go1.20.4 Git commit: 659604f Built: Thu May 25 21:52:10 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.21 GitCommit: 3dce8eb055cbb6872793272b4f20ed16117344f8 runc: Version: 1.1.7 GitCommit: v1.1.7-0-g860f061 docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
No response
The text was updated successfully, but these errors were encountered: