Commit graph

48109 commits

Author SHA1 Message Date
Sebastiaan van Stijn
49f3e7d233
Dockerfile: remove APT_MIRROR build-arg
This option was originally added in 8ec8564691,
at which time the upstream debian package repositories were not always
reliable, so using a mirror helped with CI stability and performance.

Debian's package repositories are a lot more reliable now, so there's no
longer a need to use a mirror.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-04 13:52:58 +01:00
Sebastiaan van Stijn
df59a357ec
Merge pull request #46877 from robmry/early_error_for_cifs_url_with_port
Don't allow port in CIFS URL
2023-12-04 12:44:02 +01:00
Sebastiaan van Stijn
bcc0315003
Merge pull request #46882 from vvoland/vendor-buildkit-0.12.4
vendor: github.com/moby/buildkit v0.12.4
2023-12-04 12:42:05 +01:00
Rob Murray
baca6cb417 Don't allow port in CIFS URL
When creating a CIFS volume, generate an error if the device URL
includes a port number, for example:
   --opt device="//some.server.com:2345/thepath"

The port must be specified in the port option instead, for example:
    --opt o=username=USERNAME,password=PASSWORD,vers=3,sec=ntlmsspi,port=1234

Signed-off-by: Rob Murray <rob.murray@docker.com>
2023-12-04 10:08:09 +00:00
Paweł Gronowski
c8134fa046
vendor: github.com/moby/buildkit v0.12.4
full diff: https://github.com/moby/buildkit/compare/v0.12.3...v0.12.4

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-12-04 10:56:20 +01:00
Sebastiaan van Stijn
029519a149
Merge pull request #46876 from thaJeztah/bump_mux
vendor: github.com/gorilla/mux v1.8.1
2023-12-01 16:26:10 +01:00
Sebastiaan van Stijn
faa843fcef
vendor: github.com/gorilla/mux v1.8.1
full diff: https://github.com/gorilla/mux/compare/v1.8.0...v1.8.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-01 12:48:09 +01:00
Sebastiaan van Stijn
f179243876
Merge pull request #46875 from thaJeztah/bump_cobra
vendor: github.com/spf13/cobra v1.8.0
2023-12-01 12:09:44 +01:00
Sebastiaan van Stijn
028ed1bb22
vendor: github.com/spf13/cobra v1.8.0
full diff: https://github.com/spf13/cobra/compare/v1.7.0...v1.8.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-01 11:01:59 +01:00
Sebastiaan van Stijn
bb99b3f02e
Merge pull request #46871 from thaJeztah/less_cobra_customisation
cmd/dockerd: remove various cobra templating
2023-12-01 10:58:07 +01:00
Sebastiaan van Stijn
d3533eee68
Merge pull request #46849 from robmry/37937_explicit_bridge_mtu
Explicitly set MTU on bridge devices.
2023-11-30 22:30:11 +01:00
Tianon Gravi
488fe76eb8
Merge pull request #45789 from thaJeztah/update_debian
Dockerfile: update to Debian "bookworm", and update frozen images to debian:bookworm-slim
2023-11-30 12:33:48 -08:00
Sebastiaan van Stijn
75546e1e46
Merge pull request #46865 from vvoland/c8d-fix-DockerRegistryAuthTokenSuite
c8d/integration-cli: Adjust DockerRegistryAuthTokenSuite
2023-11-30 17:36:45 +01:00
Sebastiaan van Stijn
ec7c2b784a
Merge pull request #46268 from thaJeztah/detachcontext
container: internalize InitAttachContext
2023-11-30 17:03:34 +01:00
Sebastiaan van Stijn
08035dc805
Merge pull request #46868 from vvoland/c8d-skip-TestListDanglingImagesWithDigests
c8d/integration-cli: Skip part of TestListDanglingImagesWithDigests
2023-11-30 16:16:02 +01:00
Sebastiaan van Stijn
e18f5a5304
container: internalize InitAttachContext
Move the initialization logic to the attachContext itself, so that
the container doesn't have to be aware about mutexes and other logic.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-30 15:26:53 +01:00
Sebastiaan van Stijn
c8b9dfb25e
Merge pull request #46867 from thaJeztah/log_info
daemon: kill: use log level to "warn" if container doesn't exit in time
2023-11-30 14:41:32 +01:00
Paweł Gronowski
fcb89da9c2
c8d/integration-cli: Skip TestListDanglingImagesWithDigests
Skip TestListDanglingImagesWithDigests which tests graphdriver
implementation specific behavior of `docker images --filter
dangling=true`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-11-30 14:01:22 +01:00
Sebastiaan van Stijn
61d94850a7
cmd/dockerd: make cobra templates a const
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-30 13:40:15 +01:00
Sebastiaan van Stijn
0f163170a7
cmd/dockerd: remove various cobra templating
This removes various templating functions that were added for the
docker CLI. These are not needed for the dockerd binary, which does
not have subcommands or management commands.

Revert "Only hide commands if the env variable is set."

This reverts commit a7c8bcac2b.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-30 13:40:10 +01:00
Sebastiaan van Stijn
faecc65cd3
Merge pull request #46863 from michaelkebe/fix/cifs-volume-resolve-hostname
cifs volume resolves hostname correctly
2023-11-30 12:27:46 +01:00
Paweł Gronowski
ae6960cf91
Merge pull request #46857 from vvoland/liverestore-fix-46308
liverestore: Don't remove `--rm` containers on restart
2023-11-30 12:08:13 +01:00
Sebastiaan van Stijn
3bfb6a9420
frozen images: update to debian:bookworm-slim
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-30 12:01:06 +01:00
Sebastiaan van Stijn
fd40dfaf58
Dockerfile: remove uses of DEBIAN_FRONTEND
We used DEBIAN_FRONTEND in some places to prevent installation of packages
from being blocked. However, debian bookworm now [includes a fix][1] for
situations like this (it was specifically reported for Docker situations <3),
so we can get rid of these.

Thanks to Tianon for noticing this, and for linking to the Debian ticket!

[1]: https://bugs.debian.org/929417

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-30 11:51:18 +01:00
Sebastiaan van Stijn
e72c4818c4
Dockerfile: update to Debian "bookworm" (current stable)
Also switch yamllint to be installed from debian's packages, which are
currently at v1.29.0.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-30 11:50:34 +01:00
Michael Kebe
8ae94cafa5 cifs volume resolves hostname correctly.
Co-authored-by: Paweł Gronowski <me@woland.xyz>
Signed-off-by: Michael Kebe <michael.kebe@gmail.com>
2023-11-30 11:32:04 +01:00
Paweł Gronowski
3a0af5ad30
integration/TestLiveRestore: Wait for process to exit
Replace `time.Sleep` with a poll that checks if process no longer exists
to avoid possible race condition.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-11-30 10:15:58 +01:00
Brian Goff
718fafed26
Merge pull request #46859 from thaJeztah/fix_TestDaemonICC_tests
integration-cli: fix TestDaemonICC tests for newer iptables versions
2023-11-29 07:22:15 -08:00
Sebastiaan van Stijn
61d8f57f2a
daemon: kill: use log level to "warn" if container doesn't exit in time
I noticed this log being logged as an error, but the kill logic actually
proceeds after this (doing a "direct" kill instead). While usually containers
are expected to be exiting within the given timeout, I don't think this
needs to be logged as an error (an error is returned after we fail to
kill the container).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-29 16:18:34 +01:00
Paweł Gronowski
e262cd38ad
c8d/integration-cli: Adjust DockerRegistryAuthTokenSuite
The auth service error response is not a part of the spec and containerd
doesn't parse it like the Docker's distribution does.

Check for containerd specific errors instead.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-11-29 14:28:18 +01:00
Sebastiaan van Stijn
5dde37c846
Merge pull request #46861 from tonistiigi/gc-time-filter
builder-next: fix timing filter for default policy
2023-11-29 12:20:46 +01:00
Tonis Tiigi
49d088d9ce
builder-next: fix timing filter for default policy
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-11-28 22:37:30 -08:00
Sebastiaan van Stijn
c3eed9fa3e
integration-cli: fix TestDaemonICC tests for newer iptables versions
Debian Woodworm ships with a newer version of iptables, which caused two
tests to fail:

    === FAIL: amd64.integration-cli TestDockerDaemonSuite/TestDaemonICCLinkExpose (1.18s)
    docker_cli_daemon_test.go:841: assertion failed: false (matched bool) != true (true bool): iptables output should have contained "DROP.*all.*ext-bridge6.*ext-bridge6", but was "Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)\n pkts bytes target prot opt in out source destination \n 0 0 DOCKER-USER 0 -- * * 0.0.0.0/0 0.0.0.0/0 \n 0 0 DOCKER-ISOLATION-STAGE-1 0 -- * * 0.0.0.0/0 0.0.0.0/0 \n 0 0 ACCEPT 0 -- * ext-bridge6 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED\n 0 0 DOCKER 0 -- * ext-bridge6 0.0.0.0/0 0.0.0.0/0 \n 0 0 ACCEPT 0 -- ext-bridge6 !ext-bridge6 0.0.0.0/0 0.0.0.0/0 \n 0 0 DROP 0 -- ext-bridge6 ext-bridge6 0.0.0.0/0 0.0.0.0/0 \n"
    --- FAIL: TestDockerDaemonSuite/TestDaemonICCLinkExpose (1.18s)

    === FAIL: amd64.integration-cli TestDockerDaemonSuite/TestDaemonICCPing (1.19s)
    docker_cli_daemon_test.go:803: assertion failed: false (matched bool) != true (true bool): iptables output should have contained "DROP.*all.*ext-bridge5.*ext-bridge5", but was "Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)\n pkts bytes target prot opt in out source destination \n 0 0 DOCKER-USER 0 -- * * 0.0.0.0/0 0.0.0.0/0 \n 0 0 DOCKER-ISOLATION-STAGE-1 0 -- * * 0.0.0.0/0 0.0.0.0/0 \n 0 0 ACCEPT 0 -- * ext-bridge5 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED\n 0 0 DOCKER 0 -- * ext-bridge5 0.0.0.0/0 0.0.0.0/0 \n 0 0 ACCEPT 0 -- ext-bridge5 !ext-bridge5 0.0.0.0/0 0.0.0.0/0 \n 0 0 DROP 0 -- ext-bridge5 ext-bridge5 0.0.0.0/0 0.0.0.0/0 \n"
    --- FAIL: TestDockerDaemonSuite/TestDaemonICCPing (1.19s)

Both the `TestDaemonICCPing`, and `TestDaemonICCLinkExpose` test were introduced
in dd0666e64f. These tests called `iptables` with
the `-n` (`--numeric`) option, which prevents it from doing a reverse-DNS lookup
as an optimization.

However, the `-n` option did not have an effect to the `prot` column before
commit [da8ecc62dd765b15df84c3aa6b83dcb7a81d4ffa] (iptables < v1.8.9 or v1.8.8).
Newer versions, such as the iptables version shipping with Debian Woodworm do,
so we need to update the expected output for this version.

This patch removes the `-n` option, to keep the test more portable, also when
run non-containerized, and removes the use of regular expressions to check the
result, as these regular expressions were quite permissive (using `.*` wild-
card matching). Instead, we're getting the

With this change;

make DOCKER_GRAPHDRIVER=vfs TEST_FILTER=TestDaemonICC TEST_IGNORE_CGROUP_CHECK=1 test-integration
...
--- PASS: TestDockerDaemonSuite (139.11s)
--- PASS: TestDockerDaemonSuite/TestDaemonICCLinkExpose (54.62s)
--- PASS: TestDockerDaemonSuite/TestDaemonICCPing (84.48s)

[da8ecc62dd765b15df84c3aa6b83dcb7a81d4ffa]: https://git.netfilter.org/iptables/commit/?id=da8ecc62dd765b15df84c3aa6b83dcb7a81d4ffa

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-28 18:58:03 +01:00
Paweł Gronowski
c5ea3d595c
liverestore: Don't remove --rm containers on restart
When live-restore is enabled, containers with autoremove enabled
shouldn't be forcibly killed when engine restarts.
They still should be removed if they exited while the engine was down
though.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-11-28 12:59:38 +01:00
Sebastiaan van Stijn
f6533a1df1
Merge pull request #46852 from thaJeztah/fix_systemdind_apparmor
hack/dind-systemd: make AppArmor work with systemd enabled
2023-11-27 22:14:13 +01:00
Sebastiaan van Stijn
2249db0c73
Merge pull request #46848 from vvoland/c8d-skip-TestSaveCheckTimes
c8d/integration: Adjust TestSaveCheckTimes
2023-11-27 19:54:45 +01:00
Sebastiaan van Stijn
bcf52efbb6
Merge pull request #46855 from vvoland/c8d-fix-TestCrossRepositoryLayerPush
integration-cli/TestCrossRepositoryLayerPush: Change repo name
2023-11-27 19:46:27 +01:00
Paweł Gronowski
9b399814e7
integration-cli/TestCrossRepositoryLayerPush: Change repo name
Change the repo name used as for an intermediate image so it doesn't
try to mount from the image pushed by `TestBuildMultiStageImplicitPull`.

Before this patch, this test failed because the distribution.source
labels are not cleared between tests and the busybox content still has
the distribution.source label pointing to the `dockercli/testf`
repository which is no longer present in the test registry.
So both `dockercli/busybox` and `dockercli/testf` are equally valid
mount candidates for `dockercli/crossrepopush` and containerd algorithm
just happens to select the last one.

This changes the repo name to not have the common repository component
(`dockercli`) with the `dockercli/testf` repository.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-11-27 18:12:50 +01:00
Sebastiaan van Stijn
2ef69899de
Merge pull request #46854 from thaJeztah/quota_update_size
quota: increase sparse test-image to 300MB
2023-11-27 17:12:31 +01:00
Sebastiaan van Stijn
9709b7e458
quota: increase sparse test-image to 300MB
Starting with [6e0ed3d19c54603f0f7d628ea04b550151d8a262], the minimum
allowed size is now 300MB. Given that this is a sparse image, and
the size of the image is irrelevant to the test (we check for
limits defined through project-quotas, not the size of the
device itself), we can raise the size of this image.

[6e0ed3d19c54603f0f7d628ea04b550151d8a262]: https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/commit/?id=6e0ed3d19c54603f0f7d628ea04b550151d8a262

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-27 16:08:08 +01:00
Sebastiaan van Stijn
65cfcc28ab
hack/dind: update comments around AppArmor
Provide more context to the steps we're doing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-27 14:48:51 +01:00
Sebastiaan van Stijn
cfb8ca520a
hack/dind-systemd: make AppArmor work with systemd enabled
On bookworm, AppArmor failed to start inside the container, which can be
seen at startup of the dev-container:

    Created symlink /etc/systemd/system/systemd-firstboot.service → /dev/null.
    Created symlink /etc/systemd/system/systemd-udevd.service → /dev/null.
    Created symlink /etc/systemd/system/multi-user.target.wants/docker-entrypoint.service → /etc/systemd/system/docker-entrypoint.service.
    hack/dind-systemd: starting /lib/systemd/systemd --show-status=false --unit=docker-entrypoint.target
    systemd 252.17-1~deb12u1 running in system mode (+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -BPF_FRAMEWORK -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified)
    Detected virtualization docker.
    Detected architecture x86-64.
    modprobe@configfs.service: Deactivated successfully.
    modprobe@dm_mod.service: Deactivated successfully.
    modprobe@drm.service: Deactivated successfully.
    modprobe@efi_pstore.service: Deactivated successfully.
    modprobe@fuse.service: Deactivated successfully.
    modprobe@loop.service: Deactivated successfully.
    apparmor.service: Starting requested but asserts failed.
    proc-sys-fs-binfmt_misc.automount: Got automount request for /proc/sys/fs/binfmt_misc, triggered by 49 (systemd-binfmt)
    + source /etc/docker-entrypoint-cmd
    ++ hack/make.sh dynbinary test-integration

When checking "aa-status", an error was printed that the filesystem was
not mounted:

    aa-status
    apparmor filesystem is not mounted.
    apparmor module is loaded.

Checking if "local-fs.target" was loaded, that seemed to be the case;

    systemctl status local-fs.target
    ● local-fs.target - Local File Systems
         Loaded: loaded (/lib/systemd/system/local-fs.target; static)
         Active: active since Mon 2023-11-27 10:48:38 UTC; 18s ago
           Docs: man:systemd.special(7)

However, **on the host**, "/sys/kernel/security" has a mount, which was not
present inside the container:

    mount | grep securityfs
    securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)

Interestingly, on `debian:bullseye`, this was not the case either; no
`securityfs` mount was present inside the container, and apparmor actually
failed to start, but succeeded silently:

    mount | grep securityfs
    systemctl start apparmor
    systemctl status apparmor
    ● apparmor.service - Load AppArmor profiles
         Loaded: loaded (/lib/systemd/system/apparmor.service; enabled; vendor preset: enabled)
         Active: active (exited) since Mon 2023-11-27 11:59:09 UTC; 44s ago
           Docs: man:apparmor(7)
                 https://gitlab.com/apparmor/apparmor/wikis/home/
        Process: 43 ExecStart=/lib/apparmor/apparmor.systemd reload (code=exited, status=0/SUCCESS)
       Main PID: 43 (code=exited, status=0/SUCCESS)
            CPU: 10ms

    Nov 27 11:59:09 9519f89cade1 apparmor.systemd[43]: Not starting AppArmor in container

Same, using the `/etc/init.d/apparmor` script:

    /etc/init.d/apparmor start
    Starting apparmor (via systemctl): apparmor.service.
    echo $?
    0

And apparmor was not actually active:

    aa-status
    apparmor module is loaded.
    apparmor filesystem is not mounted.

    aa-enabled
    Maybe - policy interface not available.

After further investigating, I found that the non-systemd dind script
had a mount for AppArmor, which was added in 31638ab2ad

The systemd variant was missing this mount, which may have gone unnoticed
because `debian:bullseye` was silently ignoring this when starting the
apparmor service.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-27 14:47:59 +01:00
Paweł Gronowski
4cd2654a9d
Merge pull request #46770 from vvoland/c8d-unmount-empty-basefs
daemon/c8d: Unmount container fs after unclean shutdown
2023-11-27 13:52:00 +01:00
Paweł Gronowski
203bac0ec4
daemon/c8d: Unmount container fs after unclean shutdown
BaseFS is not serialized and is lost after an unclean shutdown. Unmount
method in the containerd image service implementation will not work
correctly in that case.
This patch will allow Unmount to restore the BaseFS if the target is
still mounted.

The reason it works with graphdrivers is that it doesn't directly
operate on BaseFS. It uses RWLayer, which is explicitly restored
immediately as soon as container is loaded.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-11-27 12:33:33 +01:00
Rob Murray
964ab7158c Explicitly set MTU on bridge devices.
This is purely cosmetic - if a non-default MTU is configured, the bridge
will have the default MTU=1500 until a container's 'veth' is connected
and an MTU is set on the veth. That's a disconcerting, it looks like the
config has been ignored - so, set the bridge's MTU explicitly.

Fixes #37937

Signed-off-by: Rob Murray <rob.murray@docker.com>
2023-11-27 11:18:54 +00:00
Paweł Gronowski
05523e289b
c8d/integration: Adjust TestSaveCheckTimes
The graphdriver implementation sets the ModTime of all image content to
match the `Created` time from the image config, whereas the containerd's
archive export code just leaves it empty (zero).

Adjust the test in the case where containerd integration is enabled to
check if config file ModTime is equal to zero (UNIX epoch) instead.

This behaviour is not a part of the Docker Image Specification and the
intention behind introducing it was to make the `docker save` produce
the same archive regardless of the time it was performed.

It would also be a bit problematic with the OCI archive layout which can
contain multiple images referencing the same content.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-11-24 14:49:02 +01:00
Sebastiaan van Stijn
ce1ee98aba
Merge pull request #46447 from akerouanton/api-predefined-networks
api: Add consts for predefined networks
2023-11-24 12:26:48 +01:00
Albin Kerouanton
5ce8eee0a4
Merge pull request #46846 from akerouanton/refactor/container-rename-move-log-args
daemon: ContainerRename: move log args to log fields
2023-11-24 11:56:38 +01:00
Albin Kerouanton
b1676a289c
daemon: ContainerRename: move log args to log fields
Also, err `e` is renamed into the more standard `err` as the defer
already uses `retErr` to avoid clashes (changed in f5a611a74).

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-11-24 11:05:02 +01:00
Sebastiaan van Stijn
cfdca8dc1d
Merge pull request #46844 from akerouanton/fix/windows-adapter-dns-param
daemon: windows: set DNS config on all adapters
2023-11-23 22:41:19 +01:00