Commit graph

48109 commits

Author SHA1 Message Date
Sebastiaan van Stijn
e36260f39a
Merge pull request #46715 from laurazard/c8d-fix-swarm-failures
c8d/exec: Add additional groups on exec
2023-10-25 17:10:45 +02:00
Djordje Lukic
8f756fe679
c8d: show the real image creation date when listing images
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-10-25 16:43:24 +02:00
Albin Kerouanton
a73dfe68d3
api: ContainerCreate: init hostConfig and networkingConfig when nil
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-10-25 15:40:40 +02:00
Djordje Lukic
7e0cb4c46f
c8d: Use the labels to get the children of an image
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-10-25 15:12:42 +02:00
Djordje Lukic
f5535d516f
c8d: Preserve image labels when tagging
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-10-25 14:56:36 +02:00
Paweł Gronowski
dcc80204bc
Merge pull request #46716 from akerouanton/fix-bad-condition
api: fix a nil check on the wrong var
2023-10-25 10:57:27 +02:00
Albin Kerouanton
70158284b7
api: fix a nil check on the wrong var
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-10-25 09:40:18 +02:00
Akihiro Suda
a66ddb7c59
Merge pull request #46711 from thaJeztah/switch_user
migrate to github.com/moby/sys/user
2023-10-25 14:07:01 +09:00
Laura Brehm
d7266afc7e
c8d/exec: Add additional groups on exec
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-10-25 02:28:39 +01:00
Sebastiaan van Stijn
df3a321164
migrate to github.com/moby/sys/user
The github.com/opencontainers/runc/libcontainer/user package was moved
to a separate module. While there's still uses of the old module in
our code-base, runc itself is migrating to the new module, and deprecated
the old package (for runc 1.2).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-24 15:45:02 +02:00
Sebastiaan van Stijn
aeb8972281
daemon: daemon.containerRestart: don't cancel restart on context cancel
commit def549c8f6 passed through the context
to the daemon.ContainerStart function. As a result, restarting containers
no longer is an atomic operation, because a context cancellation could
interrupt the restart (between "stopping" and "(re)starting"), resulting
in the container being stopped, but not restarted.

Restarting a container, or more factually; making a successful request on
the `/containers/{id]/restart` endpoint, should be an atomic operation.

This patch uses a context.WithoutCancel for restart requests.

It's worth noting that daemon.containerStop already uses context.WithoutCancel,
so in that function, we'll be wrapping the context twice, but this should
likely not cause issues (just redundant for this code-path).

Before this patch, starting a container that bind-mounts the docker socket,
then restarting itself from within the container would cancel the restart
operation. The container would be stopped, but not started after that:

    docker run -dit --name myself -v /var/run/docker.sock:/var/run/docker.sock docker:cli sh
    docker exec myself sh -c 'docker restart myself'

    docker ps -a
    CONTAINER ID   IMAGE         COMMAND                  CREATED          STATUS                       PORTS     NAMES
    3a2a741c65ff   docker:cli    "docker-entrypoint.s…"   26 seconds ago   Exited (128) 7 seconds ago             myself

With this patch: the stop still cancels the exec, but does not cancel the
restart operation, and the container is started again:

    docker run -dit --name myself -v /var/run/docker.sock:/var/run/docker.sock docker:cli sh
    docker exec myself sh -c 'docker restart myself'
    docker ps
    CONTAINER ID   IMAGE        COMMAND                  CREATED              STATUS         PORTS     NAMES
    4393a01f7c75   docker:cli   "docker-entrypoint.s…"   About a minute ago   Up 4 seconds             myself

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-24 12:56:45 +02:00
Sebastiaan van Stijn
b4a08b3b7c
Merge pull request #46700 from thaJeztah/bump_compress
vendor: github.com/klauspost/compress v1.17.2
2023-10-24 12:48:31 +02:00
Cory Snider
52da88201c hack/validate: stop suppressing Xattrs deprecation
Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-23 16:21:41 -04:00
Cory Snider
c44c9dfa79 pkg/tarsum: migrate to (tar.Header).PAXRecords
Fix a silly bug in the implementation which had the effect of
len(h.Xattrs) blank entries being inserted in the middle of
orderedHeaders. Luckily this is not a load-bearing bug: empty headers
are ignored as the tarsum digest is computed by concatenating header
keys and values without any intervening delimiter.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-23 16:21:41 -04:00
Cory Snider
3cf409aa9e pkg/archive: migrate to (tar.Header).PAXRecords
Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-23 16:21:41 -04:00
Cory Snider
6a8a792019 pkg/archive: test tar headers are interoperable
The existing pkg/archive unit tests are primarily round-trip tests which
assert that pkg/archive produces tarballs which pkg/archive can unpack.
While these tests are effective at catching regressions in archiving or
unarchiving, they have a blind spot for regressions in compatibility
with the rest of the ecosystem. For example, a typo in the capabilities
extended attribute constant would result in subtly broken image layer
tarballs, but the existing tests would not catch the bug if both the
archiving and unarchiving implementations have the same typo.

Extend the test for archiving an overlay filesystem layer to assert that
the overlayfs style whiteouts (extended attributes and device files) are
transformed into AUFS-style whiteouts (magic file names).

Extend the test for archiving files with extended attributes to assert
that the extended attribute is encoded into the file's tar header in the
standard, interoperable format compatible with the rest of the
ecosystem.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-23 16:21:41 -04:00
Sebastiaan van Stijn
452ca90fe5
Merge pull request #46698 from thaJeztah/update_gowinres
Dockerfile: update github.com/tc-hib/go-winres v0.3.1
2023-10-23 16:34:50 +02:00
Sebastiaan van Stijn
f2c67ea82f
vendor: github.com/klauspost/compress v1.17.2
fixes data corruption with zstd output in "best"

- 1.17.2 diff: https://github.com/klauspost/compress/compare/v1.17.1...v1.17.2
- full diff: https://github.com/klauspost/compress/compare/v1.16.5...v1.17.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-23 16:32:24 +02:00
Sebastiaan van Stijn
a7b44ea10f
Dockerfile: update github.com/tc-hib/go-winres v0.3.1
Update the GOWINRES_VERSION to v0.3.1;

full diff: https://github.com/tc-hib/go-winres/compare/v0.3.0...v0.3.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-23 12:12:43 +02:00
Richard Hansen
0cf113e250 Add unit tests for outgoing NAT rules
Signed-off-by: Richard Hansen <rhansen@rhansen.org>
2023-10-21 13:53:58 -04:00
Bjorn Neergaard
777e9f2710
Merge pull request #46690 from neersighted/buildkit_0.12.3
vendor: github.com/moby/buildkit v0.12.3
2023-10-20 12:58:51 -06:00
Bjorn Neergaard
619d98ab49
vendor: github.com/moby/buildkit v0.12.3
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-10-20 12:01:52 -06:00
Sebastiaan van Stijn
164167ea91
Merge pull request #46687 from thaJeztah/more_nocancel
daemon: use context.WithoutCancel in more places
2023-10-20 19:36:44 +02:00
Sebastiaan van Stijn
aad51c0b4e
daemon: daemon.shutdownContainer: use context.WithoutCancel
Use context.WithoutCancel so that both the containerStop and
container.Wait can share the same parent context. This context is still
a "TODO", but can be wired up in future.

It's worth noting that daemon.containerStop already uses context.WithoutCancel,
so in that function, we'll be wrapping the context twice, but this should
likely not cause issues (just redundant for this code-path).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-20 17:50:06 +02:00
Sebastiaan van Stijn
dca89c67ef
daemon: daemon.containerStop: use context.WithoutCancel
Follow-up to fc94ed0a86. Now that
f6e44bc0e8 added the compatcontext
package, we can start using context.WithoutCancel.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-20 17:44:30 +02:00
Djordje Lukic
f800215946
Merge pull request #46570 from dmcgowan/fix-disk-usage-test
integration: fix disk usage test for c8d
2023-10-20 17:11:31 +02:00
Djordje Lukic
8166818791
c8d: Return the "tag does not exist error"
In the tagged case the error message when the image/tag is not found
should be "tag does not exist: ref"

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-10-20 16:55:20 +02:00
Sebastiaan van Stijn
c3ca4f5de0
Merge pull request #46088 from thaJeztah/remove_deprecated_utils
integration-cli: remove deprecated `dockerCmd` and `waitRun` utilities
2023-10-20 15:44:46 +02:00
Sebastiaan van Stijn
74641d2006
Merge pull request #46680 from vvoland/c8d-history-off-by-one
c8d/history: Fill ID for parents without the label
2023-10-19 22:59:29 +02:00
Cory Snider
4af420f978 libnetwork/internal/kvstore: prune unused method
The datastore never calls Get() due to how the cache is implemented.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-19 12:57:42 -04:00
Cory Snider
4039b9c9c4 libnetwork/datastore: drop (KVObject).DataScope()
It wasn't being used for anything meaningful.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-19 12:38:39 -04:00
Cory Snider
4f4a897dda libnetwork/datastore: drop (*Store).Scope() method
It unconditionally returned scope.Local.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-19 12:38:37 -04:00
Cory Snider
4b40d82233 libnetwork/datastore: un-embed mutex from cache
Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-19 12:37:12 -04:00
Cory Snider
9536fabaa8 libnetwork/datastore: minor code cleanup
While there is nothing inherently wrong with goto statements, their use
here is not helping with readability.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-19 12:37:12 -04:00
Cory Snider
43dccc6c1a libnetwork/datastore: unconditionally use ds.cache
ds.cache is never nil so the uncached code paths are unreachable in
practice. And given how many KVObject deep-copy implementations shallow
copy pointers and other reference-typed values, there is the distinct
possibility that disabling the datastore cache could break things.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-10-19 12:37:10 -04:00
Sebastiaan van Stijn
5a72ed3406
integration-cli: remove deprecated dockerCmd and waitRun utilities
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 18:02:30 +02:00
Sebastiaan van Stijn
06115bf82c
integration-cli: DockerCLIPruneSuite: replace dockerCmd
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 18:02:16 +02:00
Sebastiaan van Stijn
285ab8c861
integration-cli: DockerCLIPluginsSuite: replace dockerCmd
Also fixed some variables that shadowed package-level vars, and
used consts for fixed values.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 18:02:04 +02:00
Sebastiaan van Stijn
e28da7686e
integration-cli: DockerCLIPluginLogDriverSuite: replace dockerCmd
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 18:01:46 +02:00
Sebastiaan van Stijn
a837cb444c
integration-cli: DockerExternalVolumeSuite: replace dockerCmd
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 18:01:37 +02:00
Sebastiaan van Stijn
5f884478e5
integration-cli: DockerCLIImportSuite: replace dockerCmd
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 18:01:24 +02:00
Sebastiaan van Stijn
885eceba1d
integration-cli: DockerCLITopSuite: replace dockerCmd
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 18:01:09 +02:00
Sebastiaan van Stijn
6ce6b63482
integration-cli: DockerCLIHistorySuite: replace dockerCmd
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 18:00:56 +02:00
Sebastiaan van Stijn
268e72f10f
integration-cli: DockerCLIRestartSuite: replace dockerCmd and waitRun
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 18:00:39 +02:00
Sebastiaan van Stijn
c388416aac
integration-cli: DockerCLICreateSuite: replace dockerCmd and waitRun
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 18:00:27 +02:00
Sebastiaan van Stijn
5c297fcc09
integration-cli: DockerCLIStatsSuite: replace dockerCmd and waitRun
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 18:00:00 +02:00
Sebastiaan van Stijn
7d2a6f2030
integration-cli: DockerCLICommitSuite: replace dockerCmd
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 17:59:48 +02:00
Sebastiaan van Stijn
a4522b6a8f
integration-cli: DockerCLIStartSuite: replace dockerCmd
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 17:59:34 +02:00
Sebastiaan van Stijn
f7ddfdbae6
integration-cli: DockerCLIUpdateSuite: replace dockerCmd and waitRun
Also adding some consts for fixed values.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 17:59:24 +02:00
Sebastiaan van Stijn
d1108b8a06
integration-cli: DockerDaemonSuite: replace dockerCmd
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-19 17:59:10 +02:00