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

add env and user to inspect in dockercompat #4007

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Shubhranshu153
Copy link
Contributor

@Shubhranshu153 Shubhranshu153 commented Mar 14, 2025

Issue:
Docker Compat Inspect doesn't have Env and User parameter for the process

Description:
This PR adds Env and User for the docker compat inspect

Test:

  1. Before adding the Env
   "Config": {
            "Hostname": "8ef7e6dbae24",
            "AttachStdin": false,
            "Labels": {
                "dev.containers.id": "base-alpine",
                "dev.containers.release": "v0.4.10",
}
  1. After adding the Env:
    "Config": {
      "Hostname": "08826b4795c7",
      "AttachStdin": false,
      "Env": [
        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
        "HOSTNAME=08826b4795c7"
      ],
  "Labels": {
        "dev.containers.id": "base-alpine",
        "dev.containers.release": "v0.4.10",

}

  1. Before adding the User
   "Config": {
            "Hostname": "8ef7e6dbae24",
            "AttachStdin": false,
            "Labels": {
                "dev.containers.id": "base-alpine",
                "dev.containers.release": "v0.4.10",
}
  1. After adding the User
 "Config": {
            "Hostname": "5dceef466aa1",
            "User": "test",
            "AttachStdin": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "HOSTNAME=5dceef466aa1"
            ],
            "Labels": {
                "devcontainer.config_file": "/Users/shubhum/Documents/devcontainers/.devcontainer/devcontainer.json",
                "devcontainer.local_folder": "/Users/shubhum/Documents/devcontainers",
                }

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda added this to the v2.0.4 milestone Mar 14, 2025
@Shubhranshu153 Shubhranshu153 changed the title add env to inspect add env and user to inspect in dockercompat Mar 14, 2025
@AkihiroSuda
Copy link
Member

CI is failing

@AkihiroSuda AkihiroSuda modified the milestones: v2.0.4, v2.x.x Mar 18, 2025
@Shubhranshu153
Copy link
Contributor Author

Docker and nerdctl handle create calls with --user differently.
Docker throws error during the run phase:

shubhum@147ddaa42911 nerdctl % docker create --name test --user test alpine
0fef3f3ffb87fc20b282a6bba0f20b5d2ece1e42f495777f5c67581c1a65725c
shubhum@147ddaa42911 nerdctl %  docker start 0f  
Error response from daemon: unable to find user test: no matching entries in passwd file
Error: failed to start containers: 0f
shubhum@147ddaa42911 nerdctl % 

nerdctl on the other hand fails during the create call

[shubhum@lima-finch nerdctl]$ sudo nerdctl create --name test --user test alpine
FATA[0000] mount callback failed on /tmp/containerd-mount2785573027: no users found 

@Shubhranshu153 Shubhranshu153 force-pushed the feat-add-env-to-inspect branch from 563925c to 014161a Compare March 18, 2025 21:28
@Shubhranshu153 Shubhranshu153 force-pushed the feat-add-env-to-inspect branch 2 times, most recently from af1725c to 0f183b1 Compare March 19, 2025 18:42
@Shubhranshu153
Copy link
Contributor Author

@apostasie do you happen to know this error. i am wondering if it is a race condiiton

 timed out to access cache storage. other debug session is running?

@apostasie
Copy link
Contributor

@apostasie do you happen to know this error. i am wondering if it is a race condiiton

 timed out to access cache storage. other debug session is running?

Never seen this. This is buildg territory, right? So, @ktock might have an idea.

Let me look more closely at your changeset though.

@apostasie
Copy link
Contributor

Coming from https://github.com/ktock/buildg/blob/main/pkg/buildkit/client.go#L83 - so, definitely buildg.

Not sure why or when that would happen, but having looked at your changeset, I do not think this is related and probably is some network fluke.

@Shubhranshu153 Shubhranshu153 force-pushed the feat-add-env-to-inspect branch from 0f183b1 to 5d9a892 Compare March 20, 2025 00:17
@AkihiroSuda
Copy link
Member

Needs rebase

Signed-off-by: Shubharanshu Mahapatra <[email protected]>
Signed-off-by: Shubharanshu Mahapatra <[email protected]>
@Shubhranshu153 Shubhranshu153 force-pushed the feat-add-env-to-inspect branch from 5d9a892 to bbf2ab7 Compare March 20, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants