Commit graph

45705 commits

Author SHA1 Message Date
Sebastiaan van Stijn
3b569cc686
daemon/graphdriver/windows: cleanup errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-14 23:00:48 +01:00
Sebastiaan van Stijn
bbeaeee3c7
daemon/graphdriver/windows: remove some intermediate variables
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-14 23:00:48 +01:00
Sebastiaan van Stijn
9db5dc9a46
daemon/graphdriver/windows: use strings.EqualFold()
Saves some allocations

    BenchmarkTolower
    BenchmarkTolower-5     7917788       150.4 ns/op      16 B/op       3 allocs/op
    BenchmarkEqualFold
    BenchmarkEqualFold-5   8248605       143.5 ns/op       8 B/op       1 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-14 23:00:48 +01:00
Sebastiaan van Stijn
d742188e3b
daemon/graphdriver/windows: remove fileFlagSequentialScan const
Replace it with the const that's now defined in golang.org/x/sys/windows

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-14 23:00:47 +01:00
Sebastiaan van Stijn
3a8c97be45
daemon/graphdriver/windows: rename vars that collided with imports
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-14 23:00:47 +01:00
Sebastiaan van Stijn
605e8f53b1
daemon/graphdriver/windows: InitFilter() don't use idtools.MkdirAllAndChown()
idtools.MkdirAllAndChown on Windows does not chown directories, which makes
idtools.MkdirAllAndChown() just an alias for system.MkDirAll().

Also setting the filemode to `0`, as changing filemode is a no-op on Windows as
well; both of these changes should make it more transparent that no chown'ing,
nor changing filemode takes place.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-14 23:00:44 +01:00
Sebastiaan van Stijn
ee17ecbd39
Merge pull request #45147 from cpuguy83/fix_volume_anon_from_image
Fix pruning anon volume created from image config
2023-03-14 14:04:03 +01:00
Sebastiaan van Stijn
5e9ecffb4f
Merge pull request #45139 from thaJeztah/containerd_binary_1.7.0_rc.3
update containerd binary to v1.7.0
2023-03-14 11:20:06 +01:00
Brian Goff
146df5fbd3
Fix pruning anon volume created from image config
Volumes created from the image config were not being pruned because the
volume service did not think they were anonymous since the code to
create passes along a generated name instead of letting the volume
service generate it.

This changes the code path to have the volume service generate the name
instead of doing it ahead of time.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2023-03-14 11:06:26 +01:00
Sebastiaan van Stijn
8224c74f08
Merge pull request #45148 from thaJeztah/fix_volume_error_handling
volumes: fix error-handling when removing volumes with swarm enabled
2023-03-14 10:58:40 +01:00
Sebastiaan van Stijn
058a31e479
volumes: fix error-handling when removing volumes with swarm enabled
Commit 3246db3755 added handling for removing
cluster volumes, but in some conditions, this resulted in errors not being
returned if the volume was in use;

    docker swarm init
    docker volume create foo
    docker create -v foo:/foo busybox top
    docker volume rm foo

This patch changes the logic for ignoring "local" volume errors if swarm
is enabled (and cluster volumes supported).

While working on this fix, I also discovered that Cluster.RemoveVolume()
did not handle the "force" option correctly; while swarm correctly handled
these, the cluster backend performs a lookup of the volume first (to obtain
its ID), which would fail if the volume didn't exist.

Before this patch:

    make TEST_FILTER=TestVolumesRemoveSwarmEnabled DOCKER_GRAPHDRIVER=vfs test-integration
    ...
    Running /go/src/github.com/docker/docker/integration/volume (arm64.integration.volume) flags=-test.v -test.timeout=10m  -test.run TestVolumesRemoveSwarmEnabled
    ...
    === RUN   TestVolumesRemoveSwarmEnabled
    === PAUSE TestVolumesRemoveSwarmEnabled
    === CONT  TestVolumesRemoveSwarmEnabled
    === RUN   TestVolumesRemoveSwarmEnabled/volume_in_use
        volume_test.go:122: assertion failed: error is nil, not errdefs.IsConflict
        volume_test.go:123: assertion failed: expected an error, got nil
    === RUN   TestVolumesRemoveSwarmEnabled/volume_not_in_use
    === RUN   TestVolumesRemoveSwarmEnabled/non-existing_volume
    === RUN   TestVolumesRemoveSwarmEnabled/non-existing_volume_force
        volume_test.go:143: assertion failed: error is not nil: Error response from daemon: volume no_such_volume not found
    --- FAIL: TestVolumesRemoveSwarmEnabled (1.57s)
        --- FAIL: TestVolumesRemoveSwarmEnabled/volume_in_use (0.00s)
        --- PASS: TestVolumesRemoveSwarmEnabled/volume_not_in_use (0.01s)
        --- PASS: TestVolumesRemoveSwarmEnabled/non-existing_volume (0.00s)
        --- FAIL: TestVolumesRemoveSwarmEnabled/non-existing_volume_force (0.00s)
    FAIL

With this patch:

    make TEST_FILTER=TestVolumesRemoveSwarmEnabled DOCKER_GRAPHDRIVER=vfs test-integration
    ...
    Running /go/src/github.com/docker/docker/integration/volume (arm64.integration.volume) flags=-test.v -test.timeout=10m  -test.run TestVolumesRemoveSwarmEnabled
    ...
    make TEST_FILTER=TestVolumesRemoveSwarmEnabled DOCKER_GRAPHDRIVER=vfs test-integration
    ...
    Running /go/src/github.com/docker/docker/integration/volume (arm64.integration.volume) flags=-test.v -test.timeout=10m  -test.run TestVolumesRemoveSwarmEnabled
    ...
    === RUN   TestVolumesRemoveSwarmEnabled
    === PAUSE TestVolumesRemoveSwarmEnabled
    === CONT  TestVolumesRemoveSwarmEnabled
    === RUN   TestVolumesRemoveSwarmEnabled/volume_in_use
    === RUN   TestVolumesRemoveSwarmEnabled/volume_not_in_use
    === RUN   TestVolumesRemoveSwarmEnabled/non-existing_volume
    === RUN   TestVolumesRemoveSwarmEnabled/non-existing_volume_force
    --- PASS: TestVolumesRemoveSwarmEnabled (1.53s)
        --- PASS: TestVolumesRemoveSwarmEnabled/volume_in_use (0.00s)
        --- PASS: TestVolumesRemoveSwarmEnabled/volume_not_in_use (0.01s)
        --- PASS: TestVolumesRemoveSwarmEnabled/non-existing_volume (0.00s)
        --- PASS: TestVolumesRemoveSwarmEnabled/non-existing_volume_force (0.00s)
    PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-13 19:17:35 +01:00
Sebastiaan van Stijn
a2c29e9128
update containerd binary to v1.7.0
- release notes: https://github.com/containerd/containerd/releases/tag/v1.7.0
- full diff: https://github.com/containerd/containerd/compare/v1.7.0-beta.4...v1.7.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-12 16:09:33 +01:00
Sebastiaan van Stijn
7531f05c7c
integration/volumes: TestVolumesRemove: add coverage for force/no-force
Add additional test-cases for deleting non-existing volumes (with/without force).

With this patch:

    make TEST_FILTER=TestVolumesRemove DOCKER_GRAPHDRIVER=vfs test-integration

    Running /go/src/github.com/docker/docker/integration/volume (arm64.integration.volume) flags=-test.v -test.timeout=10m  -test.run TestVolumesRemove
    ...
    === RUN   TestVolumesRemove
    === RUN   TestVolumesRemove/volume_in_use
    === RUN   TestVolumesRemove/volume_not_in_use
    === RUN   TestVolumesRemove/non-existing_volume
    === RUN   TestVolumesRemove/non-existing_volume_force
    --- PASS: TestVolumesRemove (0.04s)
        --- PASS: TestVolumesRemove/volume_in_use (0.00s)
        --- PASS: TestVolumesRemove/volume_not_in_use (0.01s)
        --- PASS: TestVolumesRemove/non-existing_volume (0.00s)
        --- PASS: TestVolumesRemove/non-existing_volume_force (0.00s)
    PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-12 14:50:55 +01:00
Sebastiaan van Stijn
2fa66cfce2
Merge pull request #45116 from thaJeztah/c8d_GetLayerByID
remove GetLayerByID from ImageService interface
2023-03-10 18:59:33 +01:00
Nicolas De Loof
06619763a2
remove GetLayerByID from ImageService interface
Co-authored-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-10 17:54:55 +01:00
Sebastiaan van Stijn
a1f6a70522
Merge pull request #45135 from thaJeztah/bump_go1.20.2
update to go1.20.2
2023-03-10 13:26:43 +01:00
Sebastiaan van Stijn
1816fb66c7
Merge pull request #45123 from vvoland/c8d-upstream-build-dangling
c8d/builder: Store untagged images as dangling
2023-03-10 13:25:37 +01:00
Sebastiaan van Stijn
02dec48bab
update to go1.20.2
Includes a security fix for crypto/elliptic (CVE-2023-24532).

> go1.20.2 (released 2023-03-07) includes a security fix to the crypto/elliptic package,
> as well as bug fixes to the compiler, the covdata command, the linker, the runtime, and
> the crypto/ecdh, crypto/rsa, crypto/x509, os, and syscall packages.
> See the Go 1.20.2 milestone on our issue tracker for details.

https://go.dev/doc/devel/release#go1.20.minor

From the announcement:

> We have just released Go versions 1.20.2 and 1.19.7, minor point releases.
>
> These minor releases include 1 security fixes following the security policy:
>
> - crypto/elliptic: incorrect P-256 ScalarMult and ScalarBaseMult results
>
>   The ScalarMult and ScalarBaseMult methods of the P256 Curve may return an
>   incorrect result if called with some specific unreduced scalars (a scalar larger
>   than the order of the curve).
>
>   This does not impact usages of crypto/ecdsa or crypto/ecdh.
>
> This is CVE-2023-24532 and Go issue https://go.dev/issue/58647.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-10 10:18:11 +01:00
Bjorn Neergaard
40ff225b8e
Merge pull request #45132 from cpuguy83/fix_listener_regression
Fix listener parsering regression when no addr set
2023-03-09 17:47:57 -07:00
Brian Goff
37a9d6aabe Fix listener parsering regression when no addr set
5008409b5c introduced the usage of
`strings.Cut` to help parse listener addresses.
Part of that also made it error out if no addr is specified after the
protocol spec (e.g. `tcp://`).

Before the change a proto spec without an address just used the default
address for that proto.
e.g. `tcp://` would be `tcp://127.0.0.1:2375`, `unix://` would be
`unix:///var/run/docker.sock`.
Critically, socket activation (`fd://`) never has an address.

This change brings back the old behavior but keeps the usage of
`strings.Cut`.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2023-03-09 23:53:05 +00:00
Sebastiaan van Stijn
c7d2c2aa9f
Merge pull request #45130 from thaJeztah/bump_swarmkit
vendor: github.com/moby/swarmkit/v2 v2.0.0-20230309194213-a745a8755ce3
2023-03-09 23:24:50 +01:00
Sebastiaan van Stijn
3bbffe96e1
vendor: github.com/moby/swarmkit/v2 v2.0.0-20230309194213-a745a8755ce3
no changes in vendored code; only aligning dependencies

full diff: 80a528a868...a745a8755c

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-09 22:20:59 +01:00
Sebastiaan van Stijn
6f14c8ee5a
Merge pull request #44894 from thaJeztah/better_graphdriver_error
layer: NewStoreFromOptions(): include driver-name in error message
2023-03-09 12:44:23 +01:00
Sebastiaan van Stijn
06d843c2c4
Merge pull request #44732 from thaJeztah/fix_store
reference: assorted fixes and cleanups
2023-03-09 12:43:56 +01:00
Paweł Gronowski
af677245fb
c8d/builder: Store untagged images as dangling
Set `dangling-name-prefix` exporter attribute  to `moby-dangling` which
makes it create an containerd image even when user didn't provide any
name for the new image.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-08 16:59:33 +01:00
Paweł Gronowski
8f716ca06a
builder/overrides: Add consts for attribute key names
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-08 16:59:26 +01:00
Sebastiaan van Stijn
ad9d70b0e6
Merge pull request #45106 from thaJeztah/bump_swarmkit
vendor: github.com/moby/swarmkit/v2 v2.0.0-20230302163403-80a528a86877
2023-03-08 15:08:43 +01:00
Sebastiaan van Stijn
239e0a2d43
Merge pull request #44886 from AkihiroSuda/containerd-cgroups-v3
vendor: github.com/containerd/cgroups/v3 v3.0.1
2023-03-08 14:22:24 +01:00
Paweł Gronowski
e528b227a6
Merge pull request #45094 from vvoland/use-typeurl2
libcontainerd: Upgrade to typeurl/v2
2023-03-08 12:41:01 +01:00
Akihiro Suda
e807ae4f2e
vendor: github.com/containerd/cgroups/v3 v3.0.1
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-03-08 20:15:17 +09:00
Paweł Gronowski
a8f5c524a0
libcontainerd: Upgrade to typeurl/v2
In preparation for containerd v1.7 which migrates off gogo/protobuf
and changes the protobuf Any type to one that's not supported by our
vendored version of typeurl.

This fixes a compile error on usages of `typeurl.UnmarshalAny` when
upgrading to containerd v1.7.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-08 11:26:32 +01:00
Sebastiaan van Stijn
d7e5708bb4
Merge pull request #44934 from laurazard/c8d-layer-size
containerd integration: compute containers layer size
2023-03-08 08:44:17 +01:00
Laura Brehm
45ee4d7c78
c8d: Compute container's layer size
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-03-08 00:58:02 +01:00
Brian Goff
0bcdbbeedc
Merge pull request #45115 from vvoland/update-shfmt
Dockerfile: Update shfmt to 3.6.0
2023-03-07 21:23:46 +00:00
Sebastiaan van Stijn
7cda1fc4b6
Merge pull request #45103 from vvoland/testlogs-longer-timeout
TestLogs: Increase stop check poll timeout on Windows
2023-03-07 21:36:30 +01:00
Paweł Gronowski
4026148ef1
Dockerfile: Update shfmt to 3.6.0
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-07 15:46:50 +01:00
Paweł Gronowski
a0741cacef
contrib/dockerize-disk.sh: Fix indentation
Reported by shfmt

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-07 15:46:48 +01:00
Sebastiaan van Stijn
088aff1620
vendor: github.com/moby/swarmkit/v2 v2.0.0-20230302163403-80a528a86877
- fix docker service create doesn't work when network and generic-resource are both attached
- Fix removing tasks when a jobs service is removed
- CSI: Allow NodePublishVolume even when plugin does not support staging

full diff: 904c221ac2...80a528a868

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-07 12:08:27 +01:00
Sebastiaan van Stijn
b3428bcf88
Merge pull request #44079 from thaJeztah/c8d_build
containerd integration: Make build work
2023-03-07 11:26:14 +01:00
Tonis Tiigi
f8b468fda2
builder-next: enable more cache backends
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-07 10:32:40 +01:00
Djordje Lukic
bba77163ff
c8d: Make build and buildx work
- Only use the image exporter in build if we don't use containerd
  Without this "docker build" fails with:

    Error response from daemon: exporter "image" could not be found

- let buildx know we support containerd snapshotter
- Pass the current snapshotter to the buildkit worker

  If buildkit uses a different snapshotter we can't list the images any
  more because we can't find the snapshot.

builder/builder-next: make ContainerdWorker a minimal wrapper

Note that this makes "Worker" a public field, so technically one could
overwrite it.

builder-next: reenable runc executor

Currently, without special CNI config the builder would
only create host network containers that is a security issue.

Using runc directly instead of shim is faster as well
as builder doesn’t need anything from shim. The overhead
of setting up network sandbox is much slower of course.

builder/builder-next: simplify options handling

Trying to simplify the logic;

- Use an early return if multiple outputs are provided
- Only construct the list of tags if we're using an image (or moby) exporter
- Combine some logic for snapshotter and non-snapshotter handling

Create a constant for the moby exporter

Pass a context when creating a router

The context has a 10 seconds timeout which should be more than enough to
get the answer from containerd.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Co-authored-by: Tonis Tiigi <tonistiigi@gmail.com>
Co-authored-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-07 10:01:47 +01:00
Akihiro Suda
f61142cce5
Merge pull request #45109 from thaJeztah/update_buildkit_0.11.4
vendor: github.com/moby/buildkit v0.11.4
2023-03-07 13:59:45 +09:00
Bjorn Neergaard
c55662f247
Merge pull request #45108 from thaJeztah/update_authors
regenerate AUTHORS
2023-03-06 12:46:55 -07:00
Sebastiaan van Stijn
b0b3c62a84
vendor: github.com/moby/buildkit v0.11.4
- provenance: ensure URLs are redacted before written (fixes CVE-2023-26054)

full diff: https://github.com/moby/buildkit/compare/218e934edfba...v0.11.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-06 17:21:15 +01:00
Sebastiaan van Stijn
117cdb28ce
regenerate AUTHORS
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-06 17:11:00 +01:00
Sebastiaan van Stijn
6f719c74a9
Merge pull request #44958 from laurazard/c8d-docker-commit
containerd integration: `docker commit`
2023-03-06 16:25:44 +01:00
Paweł Gronowski
608a122aef
integration: Extract StopContainerWindowsPollTimeout const
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-06 16:21:55 +01:00
Paweł Gronowski
74dbb721aa
TestLogs: Increase stop check poll timeout on Windows
Stopping container on Windows can sometimes take longer than 10s which
caused this test to be flaky.
Increase the timeout to 75s when running this test on Windows.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-06 16:14:38 +01:00
Sebastiaan van Stijn
17f17c284c
Merge pull request #45092 from vvoland/c8d-dangling-filter-upstream
c8d/list: Support dangling filter
2023-03-06 15:38:58 +01:00
Laura Brehm
a34060cdb4
Resolve and store manifest when creating container
This addresses the previous issue with the containerd store where, after a container is created, we can't deterministically resolve which image variant was used to run it (since we also don't store what platform the image was fetched for).

This is required for things like `docker commit`, and computing the containers layer size later, since we need to resolve the specific image variant.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-03-06 15:13:36 +01:00