Commit graph

47122 commits

Author SHA1 Message Date
Sebastiaan van Stijn
6dba98cf38
libnetwork: implement Controller.GetSandbox(containerID)
Various parts of the code were using "walkers" to iterate over the
controller's sandboxes, and the only condition for all of them was
to find the sandbox for a given container-ID. Iterating over all
sandboxes was also sub-optimal, because on Windows, the ContainerID
is used as Sandbox-ID, which can be used to lookup the sandbox from
the "sandboxes" map on the controller.

This patch implements a GetSandbox method on the controller that
looks up the sandbox for a given container-ID, using the most optimal
approach (depending on the platform).

The new method can return errors for invalid (empty) container-IDs, and
a "not found" error to allow consumers to detect non-existing sandboxes,
or potentially invalid IDs.

This new method replaces the (non-exported) Daemon.getNetworkSandbox(),
which was only used internally, in favor of directly accessing the
controller's method.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-21 15:06:26 +02:00
Sebastiaan van Stijn
6c4153f348
libnetwork: parallelTester: move vars closer to where they're used
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-21 15:03:14 +02:00
Sebastiaan van Stijn
e690cdb6a3
libnetwork: remove redundant sandboxTable type
It was not exported so let's remove the abstraction to not make it look
like something more than it is.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-21 15:03:14 +02:00
Sebastiaan van Stijn
3c10db669e
libnetwork: remove unused SandboxKeyWalker
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-21 15:03:08 +02:00
Sebastiaan van Stijn
a01bcf9767
Merge pull request #46270 from thaJeztah/classic_build_remove_logs
classic builder: align "removing intermediate container" output
2023-08-21 12:30:55 +02:00
Sebastiaan van Stijn
cf15460a3b
Merge pull request #46273 from crazy-max/ci-bin-image-repo-origin
ci(bin-image): check repo origin
2023-08-19 11:19:13 +02:00
CrazyMax
219d4d9db9
ci(bin-image): check repo origin
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-08-19 07:19:10 +02:00
Sebastiaan van Stijn
5dc44f03f0
classic builder: align "removing intermediate container" output
This is something that stood out to me: removing the intermediate
container is part of a build step, but unlike the other output from
the build, wasn't indented (and prefixed with `--->`) to be shown
as part of the build.

This patch adds the `--->` prefix, to make it clearer what step the
removal was part of.

While at it, I also updated the message itself: this output is printed
_after_ the intermediate container has been removed, so we may as well
make it match reality, so I changed "removing" to "removed".

Before:

    echo -e 'FROM busybox\nRUN echo hello > /dev/null\nRUN echo world > /dev/null\n' | DOCKER_BUILDKIT=0 docker build --no-cache -
    Sending build context to Docker daemon  2.048kB
    Step 1/3 : FROM busybox
     ---> a416a98b71e2
    Step 2/3 : RUN echo hello > /dev/null
     ---> Running in a1a65b9365ac
    Removing intermediate container a1a65b9365ac
     ---> 8c6b57ebebdd
    Step 3/3 : RUN echo world > /dev/null
     ---> Running in 9fa977b763a5
    Removing intermediate container 9fa977b763a5
     ---> 795c1f2fc7b9
    Successfully built 795c1f2fc7b9

After:

    echo -e 'FROM busybox\nRUN echo hello > /dev/null\nRUN echo world > /dev/null\n' | DOCKER_BUILDKIT=0 docker build --no-cache -
    Sending build context to Docker daemon  2.048kB
    Step 1/3 : FROM busybox
     ---> fc9db2894f4e
    Step 2/3 : RUN echo hello > /dev/null
     ---> Running in 38d7c34c2178
     ---> Removed intermediate container 38d7c34c2178
     ---> 7c0dbc45111d
    Step 3/3 : RUN echo world > /dev/null
     ---> Running in 629620285d4c
     ---> Removed intermediate container 629620285d4c
     ---> b92f70f2e57d
    Successfully built b92f70f2e57d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-18 21:27:56 +02:00
Sebastiaan van Stijn
fc302d7b7b
Merge pull request #46146 from akerouanton/libnet-errors-into-http-status-code
api: Convert libnet's errors into HTTP status code
2023-08-18 17:21:03 +02:00
Sebastiaan van Stijn
a866e50e6e
Merge pull request #46238 from vvoland/c8d-inspect-handle-missing-config
c8d/inspect: Ignore manifest with missing config
2023-08-18 15:35:44 +02:00
Sebastiaan van Stijn
1c937c5816
Merge pull request #46189 from vvoland/c8d-more-mount-refcount
c8d integration: Use refcount mounter for diff and export
2023-08-18 15:29:13 +02:00
Sebastiaan van Stijn
6cef3c2b77
Merge pull request #46256 from crazy-max/ci-win-baseimg
windows: update default base image for dev container
2023-08-18 14:15:00 +02:00
Sebastiaan van Stijn
9efe6501bb
Merge pull request #46261 from vvoland/volume-decrement-refcount-typo
volume/local: Fix debug log typo
2023-08-18 12:50:38 +02:00
Paweł Gronowski
7f965d55c7
volume/local: Fix debug log typo
Active count is incremented, but message claimed the opposite.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-08-18 11:38:50 +02:00
Kevin Alvarez
678ce73907
windows: update default base image for dev container
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-08-18 10:19:10 +02:00
Sebastiaan van Stijn
01ac4892e0
Merge pull request #46243 from thaJeztah/remove_datascope_consts
libnetwork/datastore: remove deprecated scope consts
2023-08-17 23:49:56 +02:00
Sebastiaan van Stijn
f7ce59f7dc
Merge pull request #46259 from neersighted/bin_image_sha
ci(bin-image): populate DOCKER_GITCOMMIT, take 2
2023-08-17 22:50:57 +02:00
Sebastiaan van Stijn
0c522c6bbf
libnetwork/datastore: remove deprecated scope consts
Removes the deprecated consts, which moved to a separate "scope" package
in commit 6ec03d6745, and are no longer used;

- datastore.LocalScope
- datastore.GlobalScope
- datastore.SwarmScope

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-17 22:42:15 +02:00
Sebastiaan van Stijn
16f152b1ec
Merge pull request #46242 from thaJeztah/bump_swarmkit
vendor: github.com/moby/swarmkit/v2 v2.0.0-20230815220644-3f2e40b3ed51
2023-08-17 21:35:45 +02:00
Bjorn Neergaard
73ffb48bfb
ci(bin-image): populate DOCKER_GITCOMMIT, take 2
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-08-17 13:17:33 -06:00
Bjorn Neergaard
73e47ee39c
Merge pull request #46257 from neersighted/bin_image_sha
ci(bin-image): populate DOCKER_GITCOMMIT
2023-08-17 13:12:22 -06:00
Bjorn Neergaard
9aed6308d4
ci(bin-image): populate DOCKER_GITCOMMIT
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-08-17 11:53:27 -06:00
Albin Kerouanton
c22ec82477
libnet: Fix error capitalization
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-08-17 16:48:09 +02:00
Albin Kerouanton
bd0111c1f4
libnet: Replace NoServiceError with UnavailableError
UnavailableError is now compatible with errdefs.UnavailableError. These
errors will now return a 503 instead of a 500.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-08-17 16:46:53 +02:00
Albin Kerouanton
42d34e40f9
libnet: Replace BadRequest with InvalidParameter
InvalidParameter is now compatible with errdefs.InvalidParameter. Thus,
these errors will now return a 400 status code instead of a 500.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-08-17 16:45:04 +02:00
Paweł Gronowski
a64adda4e7
c8d/inspect: Ignore manifest with missing config
Fix a failure to inspect image if any of its present manifest references
an image config which isn't present locally.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-08-17 09:48:29 +02:00
Sebastiaan van Stijn
d83ead8434
Merge pull request #46188 from akerouanton/custom-multierror
Add a temporary drop-in replacement for errors.Join
2023-08-16 17:16:09 +02:00
Albin Kerouanton
64de635626
Add a temporary drop-in replacement for errors.Join
As we have a hard time figuring out what moby/moby#46099 should look
like, this drop-in replacement will solve the initial formatting problem
we have. It's made internal such that we can remove it whenever we want
and unlike moby/moby#46099 doesn't require thoughtful API changes.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-16 16:18:41 +02:00
Sebastiaan van Stijn
cff341e5e6
vendor: github.com/moby/swarmkit/v2 v2.0.0-20230815220644-3f2e40b3ed51
Remove uses of deprecated datastore.LocalScope const

full diff: 60421a63a7...3f2e40b3ed

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-16 14:49:13 +02:00
Sebastiaan van Stijn
b325dcbff6
Merge pull request #46195 from thaJeztah/daemon_cleanup_start
daemon: Daemon.ContainerStart(): make validateState a regular function, and remove containerNotModifiedError
2023-08-16 12:18:40 +02:00
Sebastiaan van Stijn
9889585a79
Merge pull request #46223 from thaJeztah/cleanup_handleContainerExit
daemon: Daemon.handleContainerExit(): reduce ambiguity in error handling
2023-08-16 12:17:08 +02:00
Sebastiaan van Stijn
b3e249f401
Merge pull request #46236 from thaJeztah/libnetwork_bridge_outputvars
libnetwork/drivers/bridge: setupIPChains(): name output variables
2023-08-16 11:24:44 +02:00
Sebastiaan van Stijn
0503cf2510
libnetwork/drivers/bridge: setupIPChains(): name output variables
This function has _four_ output variables of the same type, and several
defer statements that checked the error returned (but using the `err`
variable).

This patch names the return variables to make it clearer what's being
returned, and renames the error-return to `retErr` to make it clearer
where we're dealing with the returned error (and not any local err), to
prevent accidentally shadowing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-16 00:26:35 +02:00
Bjorn Neergaard
fc5702b284
Merge pull request #46184 from thaJeztah/bump_swarmkit
vendor: github.com/moby/swarmkit/v2 v2.0.0-20230808164555-1983e41a9fff
2023-08-15 16:11:58 -06:00
Bjorn Neergaard
a443c2b18d
Merge pull request #46197 from thaJeztah/bridge_nowindows
libnetwork/drivers/bridge: rename some linux-only files
2023-08-15 16:11:38 -06:00
Bjorn Neergaard
dca7544320
Merge pull request #46198 from thaJeztah/libnetwork_nowindows_testfiles
libnetwork: rename and merge unix-only testfiles
2023-08-15 16:11:21 -06:00
Sebastiaan van Stijn
52b5b5be98
Merge pull request #46224 from sam-thibault/remove-ibm-jenkins-jobs
Remove s390x and ppc64le Jenkins pipelines
2023-08-14 18:45:35 +02:00
Sebastiaan van Stijn
b9d9504df5
vendor: github.com/moby/swarmkit/v2 v2.0.0-20230808164555-1983e41a9fff
notable changes:

- Free unused volumes in more cases
- Convert BasicKeyRequest to KeyRequest to use cloudflare/cfssl 1.x.x
- reduce direct imports of logrus

diffs:

- github.com/cloudflare/cfssl v1.6.4; full diff: https://github.com/cloudflare/cfssl/compare/5d63dbd981b5...v1.6.4
- github.com/moby/swarmkit/v2; full diff: https://github.com/moby/swarmkit/compare/bc71908479e5...60421a63a7f148ba1ec7d35c55e4cf9ac03d6b78

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-14 18:39:57 +02:00
Sebastiaan van Stijn
7b66ae1531
vendor: golang.org/x/crypto v0.3.0
full diff: https://github.com/golang/crypto/compare/v0.2.0...v0.3.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-14 18:38:35 +02:00
Sebastiaan van Stijn
16cda4138d
Merge pull request #46192 from AkihiroSuda/runc-1.1.9
update runc to v1.1.9
2023-08-14 17:33:19 +02:00
Sam Thibault
59aa3dce8a
remove s390x and ppc64ls pipelines
Signed-off-by: Sam Thibault <sam.thibault@docker.com>
2023-08-14 16:54:44 +02:00
Sebastiaan van Stijn
18a0ff2b2b
daemon: Daemon.handleContainerExit(): rename err-var for clarity
The "cpErr" naming was a bit confusing; give it a more descriptive name.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-14 15:17:43 +02:00
Sebastiaan van Stijn
7b28bc51e6
Merge pull request #46209 from thaJeztah/testutils_WithPIDMode
integration/internal/container: add WithPIDMode option
2023-08-14 13:55:30 +02:00
Sebastiaan van Stijn
f8363690ca
daemon: Daemon.handleContainerExit(): reduce ambiguity in error handling
This goroutine was added in c458bca6dc, and
looks for errors from the wait channel. If no error is returned, it attempts
to start the container, and *updates* the error if a failure happened while
doing so, so that the code below it can update the container's status, and
perform auto-remove (if set for the container).

However, due to the formatting of the code, it was easy to overlook that
the "err" variable was not local to the "if" statement.

This patch breaks up the if-statement in an attempt to make it clearer that
this is not a local "err" variable, and adds a code-comment explaining the
logic.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-14 13:05:16 +02:00
Sebastiaan van Stijn
cb36f57299
Merge pull request #46208 from thaJeztah/oci_DefaultLinuxSpec_consts
oci: DefaultLinuxSpec: use OCI-spec consts for namespaces
2023-08-14 10:41:41 +02:00
Sebastiaan van Stijn
72648f0ba6
oci: DefaultLinuxSpec: use OCI-spec consts for namespaces
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-12 19:06:25 +02:00
Sebastiaan van Stijn
17571ff199
integration/internal/container: add WithPIDMode option
Some files used aliases, others didn't, and they didn't appear to be
required.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-12 19:06:01 +02:00
Sebastiaan van Stijn
917dae58e1
integration/internal/container: remove import aliases
Some files used aliases, others didn't, and they didn't appear to be
required.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-12 19:06:01 +02:00
Sebastiaan van Stijn
8bf62010a4
libnetwork: merge linux-only test-files
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-12 01:27:38 +02:00
Sebastiaan van Stijn
c0562d4eed
libnetwork: rename unix-only testfiles
Some tests were implicitly skipped through the `getTestEnv()` utility,
which made it hard to discover they were not ran on Windows.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-12 01:27:38 +02:00