Skip to content

rootless: allow exposing dockerd TCP socket easily#39493

Merged
tiborvass merged 1 commit intomoby:masterfrom
AkihiroSuda:rootlesskit-060
Jul 17, 2019
Merged

rootless: allow exposing dockerd TCP socket easily#39493
tiborvass merged 1 commit intomoby:masterfrom
AkihiroSuda:rootlesskit-060

Conversation

@AkihiroSuda
Copy link
Member

Signed-off-by: Akihiro Suda [email protected]

- What I did

allow exposing dockerd TCP socket easily in rootless mode

- How I did it

By bumping up RootlessKit from v0.4.1 to v0.6.0:
rootless-containers/rootlesskit@27a0c7a...2fcff6c

- How to verify it

$ DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS="-p 0.0.0.0:2376:2376/tcp" \
 dockerd-rootless.sh --experimental \
 -H tcp://0.0.0.0:2376 \
 --tlsverify --tlscacert=ca.pem --tlscert=cert.pem --tlskey=key.pem

- Description for the changelog

rootless: allow exposing dockerd TCP socket easily

- A picture of a cute animal (not mandatory but encouraged)
image
https://pixabay.com/photos/animal-avian-bird-cold-nature-1867125/

@AkihiroSuda
Copy link
Member Author

cc @tonistiigi @tiborvass

eg.

  $ DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS="-p 0.0.0.0:2376:2376/tcp" \
   dockerd-rootless.sh --experimental \
   -H tcp://0.0.0.0:2376 \
   --tlsverify --tlscacert=ca.pem --tlscert=cert.pem --tlskey=key.pem

This commit bumps up RootlessKit from v0.4.1 to v0.6.0:
rootless-containers/rootlesskit@27a0c7a...2fcff6c

Signed-off-by: Akihiro Suda <[email protected]>
AkihiroSuda added a commit to AkihiroSuda/docker-library-docker that referenced this pull request Jul 11, 2019
Usage:
  $ docker built -t dind-rootless .
  $ docker run -d --name dind-rootless --privileged dind-rootless
  $ docker exec dind-rootless docker info

* The daemon runs in an unprivileged user with ID 1000
* `--privileged` is still required due to seccomp, apparmor, procfs, and sysfs stuff
* `-H tcp://....` will be supported soon: moby/moby#39493

Signed-off-by: Akihiro Suda <[email protected]>
AkihiroSuda added a commit to AkihiroSuda/docker-library-docker that referenced this pull request Jul 11, 2019
Usage:

  $ docker build -t dind-rootless .
  $ docker run -d --name dind-rootless --privileged dind-rootless
  $ docker exec dind-rootless docker info

* The daemon runs in an unprivileged user with ID 1000
* `--privileged` is still required due to seccomp, apparmor, procfs, and sysfs stuff
* `-H tcp://....` will be supported soon: moby/moby#39493

Signed-off-by: Akihiro Suda <[email protected]>
AkihiroSuda added a commit to AkihiroSuda/docker-library-docker that referenced this pull request Jul 11, 2019
Usage:

  $ docker build -t dind-rootless .
  $ docker run -d --name dind-rootless --privileged dind-rootless
  $ docker exec dind-rootless docker info

* The daemon runs in an unprivileged user with ID 1000
* `--privileged` is still required due to seccomp, apparmor, procfs, and sysfs stuff
* `-H tcp://....` will be supported soon: moby/moby#39493

Signed-off-by: Akihiro Suda <[email protected]>
AkihiroSuda added a commit to AkihiroSuda/docker-library-docker that referenced this pull request Jul 11, 2019
Usage:

  $ docker build -t dind-rootless .
  $ docker run -d --name dind-rootless --privileged dind-rootless
  $ docker exec dind-rootless docker info

* The daemon runs in an unprivileged user with ID 1000
* `--privileged` is still required due to seccomp, apparmor, procfs, and sysfs stuff
* `-H tcp://....` will be supported soon: moby/moby#39493

Signed-off-by: Akihiro Suda <[email protected]>
@thaJeztah thaJeztah added the area/rootless Rootless Mode label Jul 12, 2019
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

@codecov
Copy link

codecov bot commented Jul 13, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@aa8249a). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master   #39493   +/-   ##
=========================================
  Coverage          ?   37.32%           
=========================================
  Files             ?      609           
  Lines             ?    45224           
  Branches          ?        0           
=========================================
  Hits              ?    16881           
  Misses            ?    26056           
  Partials          ?     2287

@thaJeztah
Copy link
Member

ping @tonistiigi @tiborvass PTAL

@AkihiroSuda
Copy link
Member Author

@tonistiigi @tiborvass PTAL?

@thaJeztah
Copy link
Member

I asked @tiborvass to review Yesterday; I think he was testing this.

To expose the Docker API socket via TCP, you need to launch `dockerd-rootless.sh` with `DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS="-p 0.0.0.0:2376:2376/tcp"`.

```console
$ DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS="-p 0.0.0.0:2376:2376/tcp" \
Copy link
Contributor

Choose a reason for hiding this comment

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

@AkihiroSuda ok I finally got around testing this and it works, but for usability, I think it would be better to set a smarter default for DOCKERD_ROOTLESS_ROOTLESSKIT_FLAGS based on what's in -H or maybe that's too smart? (It would have to grep for tcp:// in -H --host flags and DOCKER_HOST envvar).

Copy link
Member Author

Choose a reason for hiding this comment

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

It would need to grep daemon.json as well, so too complex for shell script :P

Copy link
Contributor

@tiborvass tiborvass left a comment

Choose a reason for hiding this comment

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

Had a small comment but no need to block this PR for that.

@AkihiroSuda
Copy link
Member Author

cherry-picked as docker-archive#300

@thaJeztah thaJeztah added this to the 20.03.0 milestone Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants