Skip to content
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

nerdctl container inspect can't show Mounts of container which is created by CRI or ctr #2934

Closed
zjumoon01 opened this issue Apr 12, 2024 · 1 comment · Fixed by #2939
Closed

Comments

@zjumoon01
Copy link

What is the problem you're trying to solve

Containers are created by CRI or ctr with bind mounts.
nerdctl inspect <container> shows Mounts is null.

#nerdctl inspect 0298a4 | grep Mounts
"Mounts": null,
0298a4 is container ID which is created by CRI

However, nerdctl inspect --mode native 0298a4 can show bind mounts which are actually in container OCI spec.

https://github.com/containerd/nerdctl/blob/main/pkg/inspecttypes/dockercompat/dockercompat.go#L251
It only shows mounts from label nerdctl/mounts .
In other words, nerdctl inspect only shows mounts of containers which are created by itself.

Describe the solution you'd like

I'm not sure the result is by design or we can do some improvements.

My proposal:

  1. inspect with dockercompat mode support showing container mounts both from CRI/ctr and nerdctl.
  2. "nerdctl/mounts" in label has higher priority.
  3. Only mounts in "bind" type from native are converted. Native container shows all types of mounts, such as tmpfs, proc, sysfs.
  4. ResolvConfPath and HostnamePath have the same issue, that should be also taken into consideration

Additional context

No response

@AkihiroSuda
Copy link
Member

My proposal:

SGTM

zjumoon01 pushed a commit to zjumoon01/nerdctl that referenced this issue Apr 15, 2024
Fix containerd#2934

Containers created by CRI or ctr with bind mounts
don't have label "nerdct/mounts".

However, 'inspect' with dockercompat mode only parses mounts
from label "nerdct/mounts".

After this patch, 'inspect' with dockercompat mode can
show CRI and ctr container bind mounts.

ResolvConfPath, HostnamePath and Hostname are taken to the same
consideration.

Signed-off-by: baijia <baijia.wr@antgroup.com>
zjumoon01 pushed a commit to zjumoon01/nerdctl that referenced this issue Apr 25, 2024
Fix containerd#2934

Containers created by CRI or ctr with bind mounts
don't have label "nerdct/mounts".

However, 'inspect' with dockercompat mode only parses mounts
from label "nerdct/mounts".

After this patch, 'inspect' with dockercompat mode can
show CRI and ctr container bind mounts.

ResolvConfPath, HostnamePath and Hostname are taken to the same
consideration.

Signed-off-by: baijia <baijia.wr@antgroup.com>
zjumoon01 pushed a commit to zjumoon01/nerdctl that referenced this issue Apr 26, 2024
Fix containerd#2934

Containers created by CRI or ctr with bind mounts
don't have label "nerdct/mounts".

However, 'inspect' with dockercompat mode only parses mounts
from label "nerdct/mounts".

After this patch, 'inspect' with dockercompat mode can
show CRI and ctr container bind mounts.

ResolvConfPath, HostnamePath and Hostname are taken to the same
consideration.

Signed-off-by: baijia <baijia.wr@antgroup.com>
zjumoon01 pushed a commit to zjumoon01/nerdctl that referenced this issue Apr 26, 2024
Fix containerd#2934

Containers created by CRI or ctr with bind mounts
don't have label "nerdct/mounts".

However, 'inspect' with dockercompat mode only parses mounts
from label "nerdct/mounts".

After this patch, 'inspect' with dockercompat mode can
show CRI and ctr container bind mounts.

ResolvConfPath, HostnamePath and Hostname are taken to the same
consideration.

Signed-off-by: baijia <baijia.wr@antgroup.com>
zjumoon01 pushed a commit to zjumoon01/nerdctl that referenced this issue May 6, 2024
Fix containerd#2934

Containers created by CRI or ctr with bind mounts
don't have label "nerdct/mounts".

However, 'inspect' with dockercompat mode only parses mounts
from label "nerdct/mounts".

After this patch, 'inspect' with dockercompat mode can
show CRI and ctr container bind mounts.

ResolvConfPath, HostnamePath and Hostname are taken to the same
consideration.

Signed-off-by: baijia <baijia.wr@antgroup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants