Commit graph

7987 commits

Author SHA1 Message Date
Derek McGowan
e97716a95a
Fix disk usage test
Check for accurate values that may contain content sizes unknown to the
usage test in the calculation. Avoid asserting using deep equals when
only the expected value range is known to the test.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-10-18 21:20:54 -07:00
Bjorn Neergaard
fd3066c168
Merge pull request #46646 from thaJeztah/start_interval_validation
HealthCheck: add validation for minimum accepted start-interval (1ms)
2023-10-16 11:07:14 -07:00
Sebastiaan van Stijn
a7dd561c4a
Merge pull request #46651 from akerouanton/releaseNetwork-NetworkDisabled
daemon: release sandbox even when NetworkDisabled
2023-10-16 19:33:08 +02:00
Paweł Gronowski
9357bcb582
c8d/pull: Return same access denied error as graphdrivers
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-16 17:54:01 +02:00
Paweł Gronowski
488559a330
c8d/push: Set distribution source recursively
After a successful push, all pushed blobs should have a
distribution.source label pointing to the new registry.

Before this commit, the label was only appended to the top-level blob
(manifest or manifest list). Adjust this to also do that recursively to
its children.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-16 17:07:39 +02:00
Paweł Gronowski
d9b5445f39
c8d/pull: Handle pull all tags
Use the distribution code to query the remote repository for tags and
pull them sequentially just like the non-c8d pull.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-16 14:19:29 +02:00
Paweł Gronowski
6040283f23
Merge pull request #46581 from vvoland/c8d-push-hide-jsons
c8d/push: Show progress only on blobs
2023-10-16 13:39:25 +02:00
payall4u
9664f33e0d
daemon: release sandbox even when NetworkDisabled
When the default bridge is disabled by setting dockerd's `--bridge=none`
option, the daemon still creates a sandbox for containers with no
network attachment specified. In that case `NetworkDisabled` will be set
to true.

However, currently the `releaseNetwork` call will early return if
NetworkDisabled is true. Thus, these sandboxes won't be deleted until
the daemon is restarted. If a high number of such containers are
created, the daemon would then take few minutes to start.

See https://github.com/moby/moby/issues/42461.

Signed-off-by: payall4u <payall4u@qq.com>
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-10-16 12:08:01 +02:00
Sebastiaan van Stijn
2df698025c
HealthCheck: add validation for minimum accepted start-interval
This is a follow-up to 2216d3ca8d, which
implemented the StartInterval for health-checks, but did not add validation
for the minimum accepted interval;

> The time to wait between checks in nanoseconds during the start period.
> It should be 0 or at least 1000000 (1 ms). 0 means inherit.

This patch adds validation for the minimum accepted interval (1ms).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-16 10:46:18 +02:00
Sebastiaan van Stijn
80a9fc6d36
Merge pull request #46565 from vvoland/c8d-mirrors-fix
daemon/RegistryHosts: Don't lose mirrors
2023-10-13 22:31:24 +02:00
Bjorn Neergaard
40fde69be9
Revert "Return no basic auth creds error when needed"
This reverts commit 8777592397, which
turns out to break other test cases/the registry flow.

The correct place to handle missing credentials is instead
15bf23df09/remotes/docker/authorizer.go (L200).

Co-authored-by: Djordje Lukic <djordje.lukic@docker.com>
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-10-13 11:39:48 -06:00
Sebastiaan van Stijn
c2aa895908
Merge pull request #46638 from vvoland/c8d-diff-singleflight
c8d/changes: Fix concurrents diffs
2023-10-13 18:12:24 +02:00
Paweł Gronowski
5a34c7c245
Merge pull request #46533 from vvoland/c8d-save-multiple-repo
c8d/save-load: Reimplement non-c8d idiosyncrasies
2023-10-13 14:41:33 +02:00
Paweł Gronowski
bb7408e851
c8d/changes: Fix concurrents diffs
Use a unique parent view snapshot key for each diff request.

I considered using singleflight at first, but I realized it wouldn't
really be correct.
The diff can take some time, so there's a window of time between the
diff start and finish, where the file system can change.
These changes not always will be reflected in the running diff.
With singleflight, the second diff request which happened before the
previous diff was finished, would not include changes made to the
container filesystem after the first diff request has started.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-13 13:15:50 +02:00
Sebastiaan van Stijn
6c1c76d02a
Merge pull request #46631 from rumpl/c8d-no-basic-auth
Return no basic auth creds error when needed
2023-10-13 13:03:26 +02:00
Paweł Gronowski
f51c5e1a5c
c8d/save: Don't save name if exported by digest
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-13 11:52:11 +02:00
Paweł Gronowski
b5f5987959
c8d/load: Fix Loaded image message
It should also contain the image tag, not just repository name.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-13 11:52:09 +02:00
Paweł Gronowski
42af8795a3
c8d/save: Implement exporting all tags
Implement a behavior from the graphdriver's export where `docker save
something` (untagged reference) would export all images matching the
specified repository.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-13 11:52:07 +02:00
Sebastiaan van Stijn
0a82696d70
Merge pull request #46483 from thaJeztah/api_move_image_types
api/types: move various types to api/types/(images|containers|swarm)
2023-10-12 15:29:11 +02:00
Djordje Lukic
8777592397
Return no basic auth creds error when needed
If the auth config contains an empty username/password we should return
an error

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-10-12 15:02:09 +02:00
Sebastiaan van Stijn
ebef4efb88
api/types: move ContainerLogsOptions to api/types/container
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-12 11:30:12 +02:00
Sebastiaan van Stijn
9670d9364d
api/types: move ContainerListOptions to api/types/container
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-12 11:29:24 +02:00
Sebastiaan van Stijn
ec69501e94
api/types: move ServiceCreateResponse, and generate from swagger
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-12 11:29:23 +02:00
Sebastiaan van Stijn
5b3e6555a3
api/types: move ServiceUpdateResponse
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-12 11:29:22 +02:00
Sebastiaan van Stijn
48cacbca24
api/types: move image-types to api/types/image
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-12 11:29:20 +02:00
Paweł Gronowski
44dbbeb196
c8d/progress: Remove unused mountable
It's no longer needed as we get this information from containerd
directly.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-12 11:08:11 +02:00
Paweł Gronowski
bcbbd9538f
c8d/progress: Show Mounted/Exists status
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-12 11:08:08 +02:00
Sebastiaan van Stijn
056be8b7b0
Merge pull request #46473 from thaJeztah/c8d_logs
migrate to github.com/containerd/log v0.1.0
2023-10-12 10:35:02 +02:00
Bjorn Neergaard
bea1462f4f
Merge pull request #46564 from AkihiroSuda/fix-46563
Limit OOMScoreAdj when running in UserNS ("Rootful-in-Rootless")
2023-10-11 12:06:18 -07:00
Sebastiaan van Stijn
cff4f20c44
migrate to github.com/containerd/log v0.1.0
The github.com/containerd/containerd/log package was moved to a separate
module, which will also be used by upcoming (patch) releases of containerd.

This patch moves our own uses of the package to use the new module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-11 17:52:23 +02:00
Sebastiaan van Stijn
d7caea206e
Merge pull request #46585 from cpuguy83/fix_etwlogs
Revert "daemon/logger/etwlogs: rewrite to use go-winio/pkg/etw"
2023-10-11 17:07:50 +02:00
Sebastiaan van Stijn
f0698dae14
Merge pull request #46590 from vvoland/c8d-tag-ctx-withoutcancel
daemon/c8d: Use WithoutCancel instead of context.Background
2023-10-11 16:55:16 +02:00
Paweł Gronowski
e78152aecb
Merge pull request #46605 from vvoland/c8d-load-compressed
c8d/load: Handle compressed archives
2023-10-11 13:48:30 +02:00
Paweł Gronowski
d871a665de
daemon/RegistryHosts: Don't lose mirrors
`docker.io` is present in the `IndexConfigs` so the `Mirrors` property
would get lost because a fresh `RegistryConfig` object was created.

Instead of creating a new object, reuse the existing one and just
mutate its fields.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-11 11:43:54 +02:00
Sebastiaan van Stijn
a67b7554c8
Merge pull request #46595 from vvoland/c8d-rmi-untaggeddangling
c8d/rmi: Don't emit Untagged for dangling images
2023-10-10 18:45:21 +02:00
Djordje Lukic
f3aa9e151d
c8d: Simplify error handling and distribution source label
Extract the distribution source label append into its own function and
make it not fail on any error, we do still log the error.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-10-10 14:13:34 +02:00
Sebastiaan van Stijn
3149c3efe6
Merge pull request #46588 from vvoland/c8d-history-ids
c8d/history: Fill ID and Tags for all entries
2023-10-10 10:05:01 +02:00
Paweł Gronowski
fcabc48ee4
c8d/load: Handle compressed archives
Allow to load images from compressed tars.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-09 14:03:22 +02:00
Paweł Gronowski
b8ba263099
c8d/rmi: Handle explicit dangling name
This isn't something that user should do, but technically the dangling
images exist in the image store and user can pass its name (`moby-dangling@digest`).
Change it so rmi now recognizes that it's actually a dangling image and
doesn't handle it like a regular tagged image.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-06 10:20:37 +02:00
Paweł Gronowski
25a813e924
c8d/rmi: Don't emit Untagged for dangling images
A dangling image isn't really a tag.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-06 10:20:35 +02:00
Brian Goff
f6fa56194f
Merge pull request #46448 from xinfengliu/improve-stats-collector
Make one-shot stats faster
2023-10-05 08:10:29 -07:00
Paweł Gronowski
f99c4ec798
c8d/history: Fill ID and Tags for all entries
Find the parent images by image set by the legacy builder.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-04 16:01:17 +02:00
Paweł Gronowski
e0e6ae741e
daemon/c8d: Use WithoutCancel instead of context.Background
Instead of passing a completely fresh context without any values, just
discard the cancellation.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-04 13:17:51 +02:00
Brian Goff
c47cdd5f39 Revert "daemon/logger/etwlogs: rewrite to use go-winio/pkg/etw"
This reverts commit a9fa147a92.
The commit is unfortunately broken as it is still using `providerHandle`
to write events but that handle is never actually set, so it is always
invalid. All logging fails.

Note: This is note a straight revert due to the change to
containerd/log.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2023-10-03 22:42:36 +00:00
Paweł Gronowski
6f27bef9fc
daemon/c8d: Use non cancellable context in defers
Fixes leases not being released when operation was cancelled.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-03 15:27:40 +02:00
Paweł Gronowski
77f7c83114
c8d/push: Show progress only on blobs
To match the graphdriver's push behavior which only shows the progress
for layers.
Exclude indexes, manifests and image configs from the push progress.
Don't explicitly check for `IsLayerType` to also handle other
potentially big blobs (like buildkit attestations).

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-03 14:59:19 +02:00
Akihiro Suda
ad877271f3
Limit OOMScoreAdj when running in UserNS ("Rootful-in-Rootless")
Fix issue 46563 "Rootful-in-Rootless dind doesn't work since systemd v250 (due to oom score adj)"

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-09-29 21:50:08 +09:00
Djordje Lukic
7d30dafd69
Merge pull request #46543 from rumpl/c8d-fix-manifest-platform 2023-09-29 13:58:57 +02:00
Xinfeng Liu
3d70af4ee4 adjust stats sampling order
Signed-off-by: Xinfeng Liu <XinfengLiu@icloud.com>
2023-09-29 15:33:48 +08:00
Djordje Lukic
f66c000229 c8d: Fix getting the platform of a single-platform image
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-09-28 00:16:51 +02:00
Sebastiaan van Stijn
3197160114
daemon: Daemon.SetNetworkBootstrapKeys: make error-handling idiomatic
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-27 12:08:28 +02:00
Sebastiaan van Stijn
f91c3cfda6
daemon: Daemon.initNetworkController: remove intermediate var
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-27 12:08:28 +02:00
Xinfeng Liu
95aea39348 Make one-shot stats faster
This commit moves one-shot stats processing out of the publishing
channels, i.e. collect stats directly.

Also changes the method of getSystemCPUUsage() on Linux to return
number of online CPUs also.

Signed-off-by: Xinfeng Liu <XinfengLiu@icloud.com>
2023-09-27 14:10:23 +08:00
Drew Erny
42a51cb285 Add support for swarm seccomp and apparmor
And also no-new-privileges

Signed-off-by: Drew Erny <derny@mirantis.com>
2023-09-25 12:38:26 -05:00
Chiranjeevi Tirunagari
0c66111c40
daemon: containers list code refactor
Signed-off-by: Chiranjeevi Tirunagari <vchiranjeeviak.tirunagari@gmail.com>
2023-09-25 10:28:31 +05:30
Sebastiaan van Stijn
3614749b55
Merge pull request #45966 from neersighted/buildkit_0.12
Update to BuildKit 0.12
2023-09-22 02:13:15 +02:00
Bjorn Neergaard
2246297ae6
builder-next: adopt new wrapped types
With BuildKit 0.12, some existing types are now required to be wrapped
by new types:

* containerd's LeaseManager and ContentStore have to be a
  (namespace-aware) BuildKit type since f044e0a946
* BuildKit's solver.CacheManager is used instead of
  bboltstorage.CacheKeyStorage since 2b30693409
* The MaxAge config field is a bkconfig.Duration since e06c96274f

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-09-21 14:18:48 -06:00
Bjorn Neergaard
8cd5f04ea3
daemon/c8d: use new containerd LabelDistributionSource constant
Introduced in dd3eedf3c3

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-09-21 14:18:42 -06:00
Bjorn Neergaard
fd6dd6935b
vendor: github.com/containerd/containerd v1.7.6
The DeepEqual ignore required in the daemon tests is a bit ugly, but it
works given the new protoc output.

We also have to ignore lints related to schema1 deprecations; these do
not apply as we must continue to support this schema version.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-09-21 14:18:40 -06:00
Bjorn Neergaard
0e80073e01
daemon: strongly type containerd log.OutputFormat
This type was introduced in
0a79e67e4f

Make use of it throughout our log-format handling code, and convert back
to a string before we pass it to the containerd client.

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-09-21 05:40:17 -06:00
Sebastiaan van Stijn
4dbfe7e17e
Merge pull request #46502 from rumpl/c8d-fix-diff
c8d: Fix `docker diff`
2023-09-20 21:16:08 +02:00
Djordje Lukic
7444b88f5d
Merge pull request #46495 from rumpl/c8d-fix-create-platform 2023-09-20 16:39:38 +02:00
Djordje Lukic
207c4d537c c8d: Fix docker diff
Diffing a container yielded some extra changes that come from the
files/directories that we mount inside the container (/etc/resolv.conf
for example). To avoid that we create an intermediate snapshot that has
these files, with this we can now diff the container fs with its parent
and only get the differences that were made inside the container.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-09-20 14:16:22 +02:00
Paweł Gronowski
601c9b29e6
c8d/pull: Fix stale Downloading progress
Final progress messages were sent after the progress updater finished
which made the "Downloading" progress not being updated into "Download
complete".

Fix by sending the final messages after the progress has finished.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-09-20 14:10:58 +02:00
Sebastiaan van Stijn
34dc2f10b4
Merge pull request #46479 from vvoland/pull-check-reserved-name-in-api
api/pull: Move reference parsing from imageService, validate repo
2023-09-19 17:17:31 +02:00
Sebastiaan van Stijn
54d84229ce
Merge pull request #46511 from rumpl/c8d-system-df-image-containers
c8d: Number of containers using an image
2023-09-19 17:08:01 +02:00
Paweł Gronowski
3ff75aeb07
c8d/pull: Deprecation notice for schema1 manifests
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-09-19 15:46:42 +02:00
Djordje Lukic
39fe25b69e
c8d: Fix getting image with platform
We weren't checking for the asked platform in the case the image was a
manifest, only if it was a manifest list.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-09-19 13:54:24 +02:00
Paweł Gronowski
68b67b3230
c8d/pull: Support legacy schema1 prettyjws manifests
Makes it possible to pull `application/vnd.docker.distribution.manifest.v1+prettyjws`
legacy manifests.

They are not stored in their original form but are converted to the OCI
manifests.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-09-19 13:17:12 +02:00
Sebastiaan van Stijn
f13065b1f7
Merge pull request #46183 from akerouanton/validate-NetworkingConfig
daemon: Improve NetworkingConfig & EndpointSettings validation
2023-09-18 22:09:29 +02:00
Djordje Lukic
2394b07bce
c8d: Number of containers using an image
Return the number of containers that use an image if it was asked,
during a `docker system df` call for example.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-09-18 19:36:49 +02:00
Albin Kerouanton
3092b261e2
daemon: move most of validateEndpointSettings into api/t/net
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-09-18 18:26:56 +02:00
Albin Kerouanton
19c07198b6
daemon: Check if endpoint address is in allowed range
This issue wasn't caught on ContainerCreate or NetworkConnect (when
container wasn't started yet).

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-09-18 17:28:07 +02:00
Albin Kerouanton
bfd8c6deb7
daemon: Validate EndpointSettings.IPAMConfig.LinkLocalIPs
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-09-18 17:28:07 +02:00
Albin Kerouanton
4bd0553274
daemon: Return all validation errors for NetworkingConfig and EndpointSettings
Thus far, validation code would stop as soon as a bad value was found.
Now, we try to validate as much as we can, to return all errors to the
API client.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-09-18 17:25:06 +02:00
Albin Kerouanton
ff503882f7
daemon: Improve NetworkingConfig & EndpointSettings validation
So far, only a subset of NetworkingConfig was validated when calling
ContainerCreate. Other parameters would be validated when the container
was started. And the same goes for EndpointSettings on NetworkConnect.

This commit adds two validation steps:

1. Check if the IP addresses set in endpoint's IPAMConfig are valid,
   when ContainerCreate and ConnectToNetwork is called ;
2. Check if the network allows static IP addresses, only on
   ConnectToNetwork as we need the libnetwork's Network for that and it
   might not exist until NetworkAttachment requests are sent to the
   Swarm leader (which happens only when starting the container) ;

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-09-18 17:21:06 +02:00
Paweł Gronowski
ccb37fa567
imageService/PullImage: Move reference parse to api
Make `PullImage` accept `reference.Named` directly instead of
duplicating the parsing code for both graphdriver and containerd image
service implementations.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-09-18 15:23:12 +02:00
Djordje Lukic
32e2c53467
c8d: Fix pull progress update
We were sending the "Pulling from ..." message too early, if the pull
progress wasn't able to resolve the image we wouldn't sent the error
back. Sending that first message would have flushed the output stream
and image_routes.go would return a nil error.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-09-16 13:07:13 +02:00
Sebastiaan van Stijn
bd523abd44
remove more direct uses of logrus
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-15 20:12:27 +02:00
Sebastiaan van Stijn
a07f6470b7
Merge pull request #46488 from thaJeztah/bump_containerd_1.6.24
vendor: github.com/containerd/containerd v1.6.24
2023-09-15 20:11:53 +02:00
Paweł Gronowski
a33043f0e0
Merge pull request #46485 from vvoland/c8d-push-all-tags
c8d/push: Support pushing all tags
2023-09-15 17:38:05 +02:00
Sebastiaan van Stijn
1ffbbe798a
vendor: github.com/containerd/containerd v1.6.24
full diff: https://github.com/containerd/containerd/compare/v1.6.22...v1.6.24

v1.6.24 release notes:

full diff: https://github.com/containerd/containerd/compare/v1.6.23...v1.6.24

The twenty-fourth patch release for containerd 1.6 contains various fixes
and updates.

Notable Updates

- CRI: fix leaked shim caused by high IO pressure
- Update to go1.20.8
- Update runc to v1.1.9
- Backport: add configurable mount options to overlay snapshotter
- log: cleanups and improvements to decouple more from logrus

v1.6.23 release notes:

full diff: https://github.com/containerd/containerd/compare/v1.6.22...v1.6.23

The twenty-third patch release for containerd 1.6 contains various fixes
and updates.

Notable Updates

- Add stable ABI support in windows platform matcher + update hcsshim tag
- cri: Don't use rel path for image volumes
- Upgrade GitHub actions packages in release workflow
- update to go1.19.12
- backport: ro option for userxattr mount check + cherry-pick: Fix ro mount option being passed

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-15 17:34:58 +02:00
Paweł Gronowski
7f281907dd
c8d/push: Add missing message about repository
Add "The push referers to repository X" message which is present in the
push output when using the graphdrivers.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-09-15 16:27:45 +02:00
Paweł Gronowski
babf907bfd
c8d/push: Support pushing all tags
Implement missing feature that pushes all tags from the provided local
repository.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-09-15 16:27:43 +02:00
Albin Kerouanton
7ec9f304e9
daemon/cluster: create managed ctr with multiple EndpointsConfig
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-09-15 14:30:03 +02:00
Albin Kerouanton
bbcd662532
api: Allow ContainerCreate to take several EndpointsConfig for >= 1.44
The API endpoint `/containers/create` accepts several EndpointsConfig
since v1.22 but the daemon would error out in such case. This check is
moved from the daemon to the api and is now applied only for API < 1.44,
effectively allowing the daemon to create containers connected to
several networks.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-09-15 10:07:29 +02:00
Sebastiaan van Stijn
20f9635469
Merge pull request #46475 from dmcgowan/c8d-registry-token-support
Add support for registry token in containerd pull logic
2023-09-14 17:18:07 +02:00
Derek McGowan
62e55fd58a
Add support for registry token in containerd pull logic
When registry token is provided, the authorization header can be
directly applied to the registry request. No other type of
authorization will be attempted when the registry token is provided.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-14 06:35:23 -07:00
Sebastiaan van Stijn
01cc1cc923
Merge pull request #46471 from foundriesio/atomic-layer-data-write
daemon: overlay2: Write layer metadata atomically
2023-09-14 12:10:17 +02:00
Sebastiaan van Stijn
39b2bf51ca
Merge pull request #46406 from akerouanton/issue-46404
daemon: fix under what conditions container's mac-address is applied
2023-09-13 23:35:07 +02:00
Mike Sul
de2447c2ab
daemon: overlay2: Write layer metadata atomically
When the daemon process or the host running it is abruptly terminated,
the layer metadata file can become inconsistent on the file system.
Specifically, `link` and `lower` files may exist but be empty, leading
to overlay mounting errors during layer extraction, such as:
"failed to register layer: error creating overlay mount to <path>:
too many levels of symbolic links."

This commit introduces the use of `AtomicWriteFile` to ensure that the
layer metadata files contain correct data when they exist on the file system.

Signed-off-by: Mike <mike.sul@foundries.io>
2023-09-13 15:07:32 +02:00
Albin Kerouanton
78479b1915
libnet: Make sure network names are unique
Fixes #18864, #20648, #33561, #40901.

[This GH comment][1] makes clear network name uniqueness has never been
enforced due to the eventually consistent nature of Classic Swarm
datastores:

> there is no guaranteed way to check for duplicates across a cluster of
> docker hosts.

And this is further confirmed by other comments made by @mrjana in that
same issue, eg. [this one][2]:

> we want to adopt a schema which can pave the way in the future for a
> completely decentralized cluster of docker hosts (if scalability is
> needed).

This decentralized model is what Classic Swarm was trying to be. It's
been superseded since then by Docker Swarm, which has a centralized
control plane.

To circumvent this drawback, the `NetworkCreate` endpoint accepts a
`CheckDuplicate` flag. However it's not perfectly reliable as it won't
catch concurrent requests.

Due to this design decision, API clients like Compose have to implement
workarounds to make sure names are really unique (eg.
docker/compose#9585). And the daemon itself has seen a string of issues
due to that decision, including some that aren't fixed to this day (for
instance moby/moby#40901):

> The problem is, that if you specify a network for a container using
> the ID, it will add that network to the container but it will then
> change it to reference the network by using the name.

To summarize, this "feature" is broken, has no practical use and is a
source of pain for Docker users and API consumers. So let's just remove
it for _all_ API versions.

[1]: https://github.com/moby/moby/issues/18864#issuecomment-167201414
[2]: https://github.com/moby/moby/issues/18864#issuecomment-167202589

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-09-12 10:40:13 +02:00
Sebastiaan van Stijn
4f28802f09
Merge pull request #46413 from thaJeztah/builder_diffid_type
daemon/containerd: use "DiffID" type for diff fields
2023-09-12 10:08:46 +02:00
Sebastiaan van Stijn
fd15ddbc30
daemon: GetImageAndReleasableLayer: simplify "FROM scratch" case
Windows doesn't support "FROM scratch", and the platform was only used
for validation on other platforms if a platform was provided, so no need
to set defaults.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-11 23:18:13 +02:00
Sebastiaan van Stijn
4229032676
daemon/containerd: use "DiffID" type for diff fields
strong-type the fields with the expected type, to make it more explicit
what we're expecting here.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-11 23:15:04 +02:00
Sebastiaan van Stijn
cdb5947316
Merge pull request #46455 from akerouanton/enable-ipv6-automatically
daemon: automatically set network EnableIPv6 if needed
2023-09-11 22:18:22 +02:00
Albin Kerouanton
5d5eeac310
daemon: automatically set network EnableIPv6 if needed
PR 4f47013feb added a validation step to `NetworkCreate` to ensure
no IPv6 subnet could be set on a network if its `EnableIPv6` parameter
is false.

Before that, the daemon was accepting such request but was doing nothing
with the IPv6 subnet.

This validation step is now deleted, and we automatically set
`EnableIPv6` if an IPv6 subnet was specified.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-09-11 20:53:29 +02:00
Sebastiaan van Stijn
51d647122a
Merge pull request #46383 from vvoland/c8d-legacybuilder-fix-layer-parent-snapshot
c8d/legacybuilder: Assorted fixes
2023-09-11 20:41:59 +02:00
Djordje Lukic
d0d3ddd045
Merge pull request #46375 from rumpl/c8d-userns-remap
c8d: Handle userns properly
2023-09-11 19:04:35 +02:00
Djordje Lukic
0313544f4a
c8d: Handle userns properly
If the daemon is run with --userns-remap we need to chown the prepared
snapshot

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-09-11 16:39:29 +02:00