Commit Graph

2197 Commits

Author SHA1 Message Date
Albin Kerouanton
ada61040e0 Merge pull request #51379 from AkihiroSuda/validate-rootlesskit-net
dockerd-rootless.sh: reject DOCKERD_ROOTLESS_ROOTLESSKIT_NET=host
2025-11-02 16:57:45 +01:00
Akihiro Suda
b6dab24a43 dockerd-rootless.sh: restore missing exit 1
Fix a regression in 7e63d2a (PR 51149)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-11-02 16:56:00 +09:00
Akihiro Suda
76b1d304e4 dockerd-rootless.sh: reject DOCKERD_ROOTLESS_ROOTLESSKIT_NET=host
`rootlesskit --net=host` does not work with Docker.

Alternative ways to run Rootless Docker without the network overhead:
- Use https://github.com/rootless-containers/bypass4netns
- Or, use `docker run --net=host` with a PR 47103 (WIP)

See issue 51363

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-11-02 16:43:43 +09:00
Paweł Gronowski
d9cf791df1 Merge pull request #51149 from robmry/rootless-pasta
dockerd-rootless.sh: if no slirp4netns, try pasta
2025-10-10 12:39:17 +02:00
Rob Murray
a6206f2da9 dockerd-rootless: default MTU 65520 for slirp4netns
When DOCKERD_ROOTLESS_ROOTLESSKIT_MTU is not set, and ...
- DOCKERD_ROOTLESS_ROOTLESSKIT_NET is not set and slirp4netns
  is selected, MTU defaults to 65520.
- DOCKERD_ROOTLESS_ROOTLESSKIT_NET=slirp4netns, MTU defaults
  to 1500.

Change the logic so that, however slirp4netns is selected, MTU
defaults to 65520.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-10-10 10:13:50 +01:00
Rob Murray
7e63d2a81b dockerd-rootless.sh: if no slirp4netns, try pasta
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-10-10 10:13:50 +01:00
Sebastiaan van Stijn
77bf85647c contrib: add docker_client SELinux policy module to access socket in container
When running the docker daemon with `--selinux-enabled`, access to the docker
socket is prevented by SELinux. To access the socket, the container must be
started with `--privileged`, with SELinux disabled (`--security-opt label=disable`),
or with (e.g.) `--security-opt label=type:container_runtime_t`, which gives
it access to files restricted to the runtime ( `dockerd` daemon) itself.

While having access to the docker socket grants full `root` permissions on
the host (e.g. through starting a privileged container using the socket),
it may be preferable to restrict the container to just the socket.

This patch adds a `docker_client.process` SELinux CIL policy module that
defines a container domain (process type). It inherits the base container
template and grants the permissions needed to use the docker socket.

Without this (and the daemon running with `--selinux-enabled`);

    docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock docker:cli -H unix:///var/run/docker.sock version
    Client:
     Version:           28.4.0
     API version:       1.51
     Go version:        go1.24.7
     Git commit:        d8eb465
     Built:             Wed Sep  3 20:56:28 2025
     OS/Arch:           linux/amd64
     Context:           default
    permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.51/version": dial unix /var/run/docker.sock: connect: permission denied

With this:

    semodule -i /usr/share/udica/templates/base_container.cil
    semodule -i ./contrib/selinux/docker_client.cil

    docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock --security-opt label=type:docker_client.process docker:cli -H unix:///var/run/docker.sock version
    Client:
     Version:           28.4.0
     API version:       1.51
     Go version:        go1.24.7
     Git commit:        d8eb465
     Built:             Wed Sep  3 20:56:28 2025
     OS/Arch:           linux/amd64
     Context:           default

    Server: Docker Engine - Community
     Engine:
      Version:          28.4.0
      API version:      1.51 (minimum version 1.24)
      Go version:       go1.24.7

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-26 17:38:36 +02:00
Serhan Tutar
f1da80e8d3 contrib/check-config: check SCTP protocol option
Signed-off-by: Serhan Tutar <randomnoise@users.noreply.github.com>
2025-09-05 10:59:36 +03:00
Sebastiaan van Stijn
023ae2e218 contrib: remove udev rules for hiding loopback devices
This reverts commit dbb47f63ab, which
added these rules to hide loopback devices from udisks. These rules
were for devicemapper, which we no longer support, and use hard-coded
paths, making them not practical for other purposes.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-02 23:30:07 +02:00
Sebastiaan van Stijn
60125b888c contrib: update dockerfiles to debian 13 "trixie"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-21 23:37:14 +02:00
Rob Murray
2fff6b442e check-config.sh: report IP forwarding sysctl state
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Rob Murray
f71e86eed5 rootless: enable IP forwarding
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-08-08 18:43:35 +01:00
Sebastiaan van Stijn
50789e2bab testutil/fakestorage: inline go code and remove contrib/httpserver
It's 12 lines of code total; we may as well write it as part of building;
it looks to be the only place this is used, so we can remove the contrib
directory, which should not be used by anyone.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-07 22:04:09 +02:00
Paweł Gronowski
b9b52d59b8 download-frozen-image-v2: Use curl -L
Passing the Auth to the redirected location was fixed in curl 7.58:
https://curl.se/changes.html#7_58_0 so we no longer need the extra
handling and can just use `-L` to let curl handle redirects.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-07 20:52:30 +02:00
Paweł Gronowski
359a881cea download-frozen-image-v2: handle 307 responses without decimal
Correctly parse HTTP response that doesn't contain an HTTP version with a decimal place:

```
< HTTP/2 307
```

The previous version would only match strings like `HTTP/2.0 307`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-08-07 20:51:42 +02:00
Sebastiaan van Stijn
141a97bdf9 Merge pull request #50555 from chunzhennn/49231-fix-memcg-swap-config-check
contrib/check-config: fix MEMCG_SWAP checking
2025-08-05 19:36:26 +02:00
Austin Vazquez
4761d97684 Merge pull request #50606 from thaJeztah/rm_contrib_syntax
contrib: remove syntax (Dockerfile syntax) files
2025-08-04 06:32:15 -07:00
Paweł Gronowski
71bd98436b Merge pull request #50607 from thaJeztah/contrib_rm_mac_install
contrib: remove `mac-install-bundle.sh` and `editorconfig`
2025-08-04 09:08:03 +00:00
Paweł Gronowski
bda0bab54f Merge pull request #50585 from robmry/nftables_check_config
check_config: add nftables modules to optional features
2025-08-04 08:29:46 +00:00
Sebastiaan van Stijn
dab42db691 contrib: remove editorconfig
This file was added in 962f347923, at which
time there already were doubts about it being useful. For Go, `gofmt`
already dictates formatting (and proper editors would integrat with
that). For other languages, most editors would already have a config,
and our CI validates formatting for various files.

Give that the file was never updated since it was added, it's fair
to say that it's unmaintained. Let's remove.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-02 00:01:43 +02:00
Sebastiaan van Stijn
5fbbf040aa contrib: remove mac-install-bundle.sh
This script was added in 6860c101ad
to allow testing a custom daemon in Docker Desktop, but has not
been maintained since, and likely no longer functional, so let's
remove.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 23:55:39 +02:00
Sebastiaan van Stijn
5a40d4ed9f contrib: remove syntax (Dockerfile syntax) files
The Dockerfile syntax is now maintained as part of BuildKit in the
https://github.com/moby/buildkit repository, but our contrib still
had syntax highlighting files for various editors;

- The TextMate (`.tmbundle`) syntax was last update 9 months ago
  in c2029cb257, but this was a stale
  pull request from 2018, so at least 7 Years behind on updates to
  the syntax.
- The vim syntax is now integrated in upstream, and our copy was
  remove 6 Years ago in 5511f45767.
- The Nano syntax was added 10 Years ago in 76bc44fb91,
  and received an update 9 Years ago in 4cb71f8082,
  and received no contributions since.
- The kate syntax was already unmaintained, and removed 9 Years ago
  in a2f695d7fa.

I think it's fair to state that these are unmaintained and severely outdated.
I _do_ think it would be good to have maintained versions of such files,
as it can improve the experience for users. However, this would be more
suitable for the BuildKit project, and I'm not sure if the current copies
of these files are a good starting point (if needed, they can still be
obtained from git history).

This patch removes the files.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 23:46:04 +02:00
Sebastiaan van Stijn
c98e5cb60b update github links to moby/moby
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-01 01:48:55 +02:00
Rob Murray
297ea75204 check_config: add nftables modules to optional features
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-07-31 19:38:33 +01:00
纯真
f866621303 contrib/check-config: fix kernel version range check
Signed-off-by: 纯真 <38834411+chunzhennn@users.noreply.github.com>
2025-07-29 10:45:18 +08:00
纯真
df8d45c7c9 contrib/check-config: fix MEMCG_SWAP
CONFIG_MEMCG_SWAP has been deprecated since kernel v5.8-rc1 (commit 2d1c498) and removed since kernel v6.1-rc1 (commit e55b9f9).

Since kernel v5.8-rc1, swap tracking has been an integral part of memory control. CONFIG_MEMCG_SWAP becomes invisible to user and simply means CONFIG_MEMCG && CONFIG_SWAP. 

Disable the check for kernel v5.8+.

Signed-off-by: 纯真 <38834411+chunzhennn@users.noreply.github.com>
2025-07-29 10:30:13 +08:00
Sebastiaan van Stijn
38453db513 contrib: remove gitdm
This was added in bf6d52bba1, but don't
think it was ever used; at least it's severely outdated, so let's
remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-24 00:54:01 +02:00
Cory Snider
ebfafa1561 contrib: add Wireshark plugins for NetworkDB
Contribute a Wireshark plugin for decrypting and dissecting
hashicorp/memberlist messages. And contribue a plugin for dissecting the
NetworkDB messages transported as memberlist User messages.

Add a feature to NetworkDB to log the encryption keys to a file for the
Wireshark memberlist plugin to consume, configured using an environment
variable.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2025-07-03 17:58:19 -04:00
Sebastiaan van Stijn
717188201a contrib: remove mkimage-xxx scripts
These scripts have not been actively maintained for several Years, are
un-tested, and there may be better alternatives / implementations to
use for this purpose. A search on GitHub only showed a single active
use of one of these scripts; let's remove them, as there are no plans
to maintain (and test) these scripts.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-01 15:51:56 +02:00
Viacheslav Gagara
10c4715a62 openrc: allow customizing containerd service name
Signed-off-by: Viacheslav Gagara <viacheslavg@gmail.com>
2025-06-08 09:10:59 +03:00
Sebastiaan van Stijn
e2b9f3d844 Merge pull request #50059 from shangmu/master
dockerd-rootless-setuptool.sh: Fix silent stop on error due to using output redirection together wit…
2025-06-03 12:05:03 +02:00
Shang Mu
6889039d76 Fix silent stop on error due to using output redirection together with set -eu.
Signed-off-by: Shang Mu <smu@princeton.edu>
2025-05-28 13:23:52 -04:00
Sebastiaan van Stijn
7263ae74cd contrib: systemd: update deprecated StartLimit options
These were originally added in 7b9ecb9700.

The `StartLimitBurst` and `StartLimitInterval` options used to be
options for `[Service]`, but were moved to the `[Unit]` in systemd 229,
and systemd 230 respectively. The `StartLimitInterval` was renamed to
`StartLimitIntervalSec`, which either takes a number (using "seconds" as
default unit) or an optional unit;

- 6bf0f408e4
- f0367da7d1

We kept these deprecated options to provide compatibility with older distros
that not yet had systemd 230, but all distros we support are now on versions
of systemd that support the new options;

    docker run --rm registry.access.redhat.com/ubi8/ubi systemctl --version
    systemd 239 (239-82.el8_10.5)
    +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=legacy

    docker run -it --rm debian:
    apt-get update && apt-get install -y systemd
    ...
    systemctl --version
    systemd 247 (247.3-7+deb11u6)
    +PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=unified

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-26 13:49:57 +02:00
Sebastiaan van Stijn
62694ab30c Merge pull request #49813 from p5/systemd-sysusers
Add systemd-sysusers contrib configuration
2025-05-09 18:25:29 +02:00
Robert Sturla
0bd82bfac2 chore: add systemd-sysusers configuration
Part of https://github.com/docker/docker-ce-packaging/issues/1186

Adds the required systemd-sysusers configuration to the
moby/moby repo.  This will be used by downstream package
maintainers (RPM, DEB etc) as a replacement to the
`groupadd` postinstall commands.

It's generally recommended to use sysusers since it is
more of a declarative method of defining these service
accounts and groups.

This configuration file specifies a group ("g") named
"docker" should be created with an automatic GID
allocation ("-").

Signed-off-by: Robert Sturla <robertsturla@outlook.com>
2025-05-08 18:26:17 +01:00
Paweł Gronowski
ead379a464 contrib/rootless-setuptool: Fix iptables detection
Fix a logical error in the rootless setup tool where the iptables error
handling was incorrectly placed. The code was setting
`faced_iptables_error=1` even when iptables was available, causing
unnecessary error messages and setup suggestions.

This patch correctly moves the error handling into the `else` branch so
that we only report iptables errors when the command is actually
unavailable.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-04-17 19:23:15 +02:00
Christopher Petito
970fc1b6f7 Basic compose file for testing OTEL bits
Signed-off-by: Christopher Petito <chrisjpetito@gmail.com>
2025-04-09 13:48:04 +02:00
Rob Murray
f80feba181 Rootlesskit: check for module nf_tables
CentOS 10 uses iptables-nft by default, and doesn't have
kernel module ip_tables - so dockerd-rootless-setuptool.sh
reports that the module is missing. It suggests installing
it (which isn't needed), or using --skip-iptables (which
disables iptables in daemon config).

So, unless "iptables --version" command reports "legacy",
check for kernel module "nf_tables" instead of "ip_tables".

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-04-03 20:25:35 +01:00
Rob Murray
f7d7fd9c52 contrib/check-config: add IPv6 modules
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-10 13:03:00 +00:00
Rob Murray
2a109e6c32 contrib/check-config: add ip_nf_raw
Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-03-10 13:03:00 +00:00
Rob Murray
18143632f7 Revert "contrib/check-config: add ipset related flags"
This reverts commit ccdfac5328.

Since commit 76417bf, the kernel ip_set module (and friends) are
not required.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2025-02-25 17:20:31 +00:00
Bjorn Neergaard
ccdfac5328 contrib/check-config: add ipset related flags
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2025-02-20 13:28:15 -07:00
YR Chen
9509f27e28 rootless: use getsubids tool for validation if possible
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: YR Chen <stevapple@icloud.com>
2025-02-06 13:46:58 +01:00
Rafael Fernández López
4e30acb63f Dockerd rootless: make {/etc,/var/run}/cdi available
When dockerd is executed with the `dockerd-rootless.sh` script, make
/etc/cdi and /var/run/cdi available to the daemon if they exist.

This makes it possible to enable the CDI integration in rootless mode.

Fixes: #47676

Signed-off-by: Rafael Fernández López <ereslibre@ereslibre.es>
2024-12-03 21:51:51 +01:00
Octol1ttle
330e717403 fix(systemd): start Docker engine *after* DNS resolution is ready
On systems using systemd to autostart Docker on boot, containers might encounter a problem where they will not have any DNS access until the container is restarted manually. This PR fixes this issue by requiring that the Docker engine service starts after nss-lookup.target. This target is reached when DNS resolution is available. See https://wiki.archlinux.org/title/Systemd#Running_services_after_the_network_is_up (paragraph "If a service needs to perform DNS queries...")

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2024-11-04 15:57:24 +05:00
Joon
c2029cb257 Update tmLanguage file to cover first escape character
If matched escape character like \" before enter " in begin statement, text editor return invalid Highlighting.
So included escape character outside of begin statement and did some refactoring.
Signed-off-by: Myeongjooon Kim kimmj8409@gmail.com

Signed-off-by: Myeongjoon Kim <kimmj8409@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-25 09:43:53 +02:00
Akihiro Suda
fafdcd1194 dockerd-rootless-setuptool.sh: let --force ignore smoke test errors
Now `dockerd-rootless-setuptool.sh install --force` ignores errors
from `rootlesskit`.

This might be useful when installing Rootless Docker into a container
image with `RUN` instructions.

Fix issue 48678

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-10-18 00:11:59 +09:00
jjimbo137
98d74e3a3c Update download-frozen-image-v2.sh added OCI v1 support
Shortened to minimum code because OCI v1 is essentially equivalent to
Docker v2.2 format. Also fixed formatting issue with jq where it wouldn't
accept newline character in chained jq commands.

Co-authored-by: Tianon Gravi <admwiggin@gmail.com>
Signed-off-by: Jimbo Jones <jjjimbo137@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-09-24 21:59:30 +02:00
Sebastiaan van Stijn
be7470ce58 Merge pull request #48216 from AkihiroSuda/docker-install-417
dockerd-rootless-setuptool.sh: move RootlessKit smoke test
2024-07-24 15:10:44 +02:00
Akihiro Suda
e2237240f5 dockerd-rootless-setuptool.sh: move RootlessKit smoke test
`dockerd-rootless-setuptool.sh check` now skips the smoke test for
running RootlessKit.

Fix docker/docker-install issue 417

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-07-23 14:35:02 +09:00