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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockerd-rootless-setuptool.sh: add nsenter subcommand (for debugging) #47084

Merged
merged 3 commits into from
Jan 17, 2024

Conversation

AkihiroSuda
Copy link
Member

- What I did
Added nsenter subcommand to dockerd-rootless-setuptool.sh.

Expected to be used for debugging.

- How I did it
Ported containerd-rootless-setuptool.sh nsenter (part of nerdctl) to dockerd-rootless-setuptool.sh
https://github.com/containerd/nerdctl/blob/v1.7.2/extras/rootless/containerd-rootless-setuptool.sh#L142-L147

- How to verify it

$ dockerd-rootless-setuptool.sh nsenter -- ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 65520 qdisc pfifo_fast state UP group default qlen 1000
    link/ether ae:c3:a3:20:53:3e brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.100/24 scope global tap0
       valid_lft forever preferred_lft forever
    inet6 fe80::acc3:a3ff:fe20:533e/64 scope link 
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:a6:36:b0:a9 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
$ dockerd-rootless-setuptool.sh nsenter -- cat /proc/self/uid_map 
         0       1001          1
         1     100000      65536
     65537     200000      65536

- Description for the changelog

dockerd-rootless-setuptool.sh: add nsenter subcommand (for debugging)

- A picture of a cute animal (not mandatory but encouraged)
馃惂

@AkihiroSuda AkihiroSuda added the area/rootless Rootless mode label Jan 16, 2024
@AkihiroSuda AkihiroSuda added this to the 25.0.0 milestone Jan 16, 2024
@AkihiroSuda AkihiroSuda changed the title dockerd-rootless-setuptool.sh: add nsenter subcommand dockerd-rootless-setuptool.sh: add nsenter subcommand (for debugging) Jan 16, 2024
@AkihiroSuda AkihiroSuda force-pushed the dockerd-rootless-setuptool-nsenter branch 2 times, most recently from 623b25f to 3273731 Compare January 16, 2024 15:19
@thaJeztah
Copy link
Member

Some failures; not sure if related in any way; perhaps you could try a rebase to get a fresh run?

@AkihiroSuda AkihiroSuda force-pushed the dockerd-rootless-setuptool-nsenter branch from 3273731 to 054ad0a Compare January 17, 2024 03:19
@AkihiroSuda AkihiroSuda marked this pull request as draft January 17, 2024 03:38
@AkihiroSuda AkihiroSuda force-pushed the dockerd-rootless-setuptool-nsenter branch from 054ad0a to 4bf86fb Compare January 17, 2024 13:47
XDG_RUNTIME_DIR will contain sockets so its path mustn't be too long.
Prior to this commit, it was set to very long path like
`/go/src/github.com/docker/docker/bundles/test-integration/TestDiskUsage/de4fb36576d7d/xdgrun`

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Now the state dir is set to `${XDG_RUNTIME_DIR}/dockerd-rootless`.

This is similar to `${XDG_RUNTIME_DIR}/containerd-rootless` used in nerdctl:
https://github.com/containerd/nerdctl/blob/v1.7.2/extras/rootless/containerd-rootless.sh#L35

Prior to this commit, the state dir was unset and a random dir under `/tmp` was used.
(e.g., `/tmp/rootlesskit1869901982`)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Usage: `dockerd-rootless-setuptool.sh nsenter -- ip a`

Expected to be used for debugging.

Ported from nerdctl's `containerd-rootless-setuptool.sh`
https://github.com/containerd/nerdctl/blob/v1.7.2/extras/rootless/containerd-rootless-setuptool.sh#L142-L147

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda AkihiroSuda force-pushed the dockerd-rootless-setuptool-nsenter branch from 4bf86fb to 84d2229 Compare January 17, 2024 13:59
@AkihiroSuda AkihiroSuda marked this pull request as ready for review January 17, 2024 15:08
@AkihiroSuda
Copy link
Member Author

AkihiroSuda commented Jan 17, 2024

Now CI is green

(I had to add testutil/daemon: shorten XDG_RUNTIME_DIR)

@thaJeztah
Copy link
Member

Arf.. those "too long" paths keep on coming back. Perhaps something we should look into at some point (maybe use some short temp-dir somewhere for test-daemons to put the socket in).

In either case, that's a separate concern, good for handling separate / follow up work.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah merged commit 83de55b into moby:master Jan 17, 2024
105 checks passed
@thaJeztah thaJeztah added the kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. label Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rootless Rootless mode kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. status/2-code-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants