Commit graph

7583 commits

Author SHA1 Message Date
Jeyanthinath Muthuram
307b09e7eb
fixing consistent aliases for OCI spec imports
Signed-off-by: Jeyanthinath Muthuram <jeyanthinath10@gmail.com>
2023-05-08 15:27:52 +05:30
Dorin Geman
2ad37e1832 daemon: handleContainerExit(): add execDuration in attributes
Add `execDuration` field to the event attributes map. This is useful for tracking how long the container ran.

Signed-off-by: Dorin Geman <dorin.geman@docker.com>
2023-05-08 10:26:33 +03:00
Laura Brehm
cad97135b3
c8d: implement missing image delete logic
Ports over all the previous image delete logic, such as:
- Introduce `prune` and `force` flags
- Introduce the concept of hard and soft image delete conflics, which represent:
  - image referenced in multiple tags (soft conflict)
  - image being used by a stopped container (soft conflict)
  - image being used by a running container (hard conflict)
- Implement delete logic such as:
  - if deleting by reference, and there are other references to the same image, just
    delete the passed reference
  - if deleting by reference, and there is only 1 reference and the image is being used
    by a running container, throw an error if !force, or delete the reference and create
    a dangling reference otherwise
  - if deleting by imageID, and force is true, remove all tags (otherwise soft conflict)
  - if imageID, check if stopped container is using the image (soft conflict), and
    delete anyway if force
  - if imageID was passed in, check if running container is using the image (hard conflict)
  - if `prune` is true, and the image being deleted has dangling parents, remove them

This commit also implements logic to get image parents in c8d by comparing shared layers.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-05-08 02:32:03 +01:00
Sebastiaan van Stijn
de363f1404
daemon: handleContainerExit(): use logrus.WithFields
Use `WithFields()` instead of chaining multiple `WithField()` calls.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-07 21:24:34 +02:00
Sebastiaan van Stijn
fb96b94ed0
daemon: remove handling for deprecated "oom-score-adjust", and produce error
This option was deprecated in 5a922dc162, which
is part of the v24.0.0 release, so we can remove it from master.

This patch;

- adds a check to ValidatePlatformConfig, and produces a fatal error
  if oom-score-adjust is set
- removes the deprecated libcontainerd/supervisor.WithOOMScore
- removes the warning from docker info

With this patch:

    dockerd --oom-score-adjust=-500 --validate
    Flag --oom-score-adjust has been deprecated, and will be removed in the next release.
    unable to configure the Docker daemon with file /etc/docker/daemon.json: merged configuration validation from file and command line flags failed: DEPRECATED: The "oom-score-adjust" config parameter and the dockerd "--oom-score-adjust" options have been removed.

And when using `daemon.json`:

    dockerd --validate
    unable to configure the Docker daemon with file /etc/docker/daemon.json: merged configuration validation from file and command line flags failed: DEPRECATED: The "oom-score-adjust" config parameter and the dockerd "--oom-score-adjust" options have been removed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-06 16:36:17 +02:00
Sebastiaan van Stijn
913b0f51ca
API: omit deprecated VirtualSize field for API v1.44 and up
This field is deprecated since 1261fe69a3,
and will now be omitted on API v1.44 and up for the `GET /images/json`,
`GET /images/{id}/json`, and `GET /system/df`  endpoints.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-06 16:35:00 +02:00
Brian Goff
698fa85f38
Merge pull request #45463 from corhere/copy-xattr-notsupp
d/graphdriver/copy: support src fs w/o xattr support
2023-05-04 12:00:50 -07:00
Sebastiaan van Stijn
0e8eea5a70
Merge pull request #45338 from thaJeztah/split_securityoptions
container: split security options to a SecurityOptions struct
2023-05-04 19:47:24 +02:00
Cory Snider
2b6761fd3e d/graphdriver/copy: support src fs w/o xattr support
Treat copying extended attributes from a source filesystem which does
not support extended attributes as a no-op, same as if the file did not
possess the extended attribute. Only fail copying extended attributes if
the source file has the attribute and the destination filesystem does
not support xattrs.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-05-04 12:30:59 -04:00
Sebastiaan van Stijn
2adec6c8c0
Merge pull request #45438 from thaJeztah/c8d_fix_image_commit
c8d: commit: generateCommitImageConfig: don't merge image config
2023-05-04 11:28:43 +02:00
Sebastiaan van Stijn
167fa429f0
daemon: Daemon.CreateImageFromContainer(): remove intermediate vars
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-29 02:59:54 +02:00
Sebastiaan van Stijn
9613da63dc
c8d: commit: generateCommitImageConfig: don't merge image config
daemon.CreateImageFromContainer() already constructs a new config by taking
the image config, applying custom options (`docker commit --change ..`) (if
any), and merging those with the containers' configuration, so there is
no need to merge options again.

e22758bfb2/daemon/commit.go (L152-L158)

This patch removes the merge logic from generateCommitImageConfig, and
removes the unused arguments and error-return.

Co-authored-by: Djordje Lukic <djordje.lukic@docker.com>
Co-authored-by: Laura Brehm <laurabrehm@hey.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-29 02:53:54 +02:00
Sebastiaan van Stijn
e510abbc8c
daemon/containerd: containerConfigToOciImageConfig: add ArgsEscaped
The OCI image-spec now also provides ArgsEscaped for backward compatibility
with the option used by Docker.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-29 00:20:07 +02:00
Sebastiaan van Stijn
3eebf4d162
container: split security options to a SecurityOptions struct
- Split these options to a separate struct, so that we can handle them in isolation.
- Change some tests to use subtests, and improve coverage

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-29 00:03:37 +02:00
Brian Goff
dffad6b0b7
Merge pull request #45426 from vvoland/c8d-import-dangling
c8d/import: Don't gc unnamed images
2023-04-28 11:18:55 -07:00
Sebastiaan van Stijn
3cad7f99e0
Merge pull request #45431 from laurazard/remove-dangling-pull
c8d: delete dangling image on pull
2023-04-28 19:52:55 +02:00
Laura Brehm
44a6587608
c8d: delete dangling image on pull
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-04-28 17:41:56 +01:00
Paweł Gronowski
1845a915b0
c8d/import: Don't gc unnamed images
Create dangling images for imported images which don't have a name
annotation attached. Previously the content got loaded, but no image
referencing it was created which caused it to be garbage collected
immediately.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-28 09:30:04 +02:00
Tianon Gravi
4597f50deb
Merge pull request #45392 from thaJeztah/filters_inline_and_simplify
inline filters.Args where possible, and use filters.Arg() when constructing
2023-04-27 23:31:59 +00:00
Sebastiaan van Stijn
c80f205f86
Merge pull request #45298 from thaJeztah/pkg_pkatform_cleanup
pkg/platform: cleanup, and deprecate OSType
2023-04-27 02:02:41 +02:00
Sebastiaan van Stijn
79dd264517
Merge pull request #45339 from vvoland/c8d-prune-upstream-gc
c8d/prune: Remove gc.ref labels from configs of deleted images
2023-04-26 22:54:10 +02:00
Sebastiaan van Stijn
8ff481b436
Merge pull request #45393 from vvoland/c8d-fix-panic-imagemanifest
containerd integration: Handle nil container.ImageManifest
2023-04-26 17:02:06 +02:00
Paweł Gronowski
520aa08d42
c8d/prune: Logging fixes
- Use logrus.Fields instead of multiple WithField
- Split one giant debug log into one log per image

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-26 16:40:37 +02:00
Paweł Gronowski
52af6d957e
c8d/prune: Remove gc.ref labels from configs of deleted images
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-26 16:40:34 +02:00
Paweł Gronowski
9fe5ac6614
c8d: Handle nil container.ImageManifest
Don't panic when processing containers created under fork containerd
integration (this field was added in the upstream and didn't exist in
fork).

Co-authored-by: Djordje Lukic <djordje.lukic@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-26 14:54:01 +02:00
Sebastiaan van Stijn
2379b49177
Merge pull request #45362 from laurazard/c8d-delete-short-images
c8d: add support for removing images by shortID
2023-04-26 11:34:34 +02:00
Brian Goff
0970cb054c
Merge pull request #45366 from akerouanton/fix-docker0-PreferredPool
daemon: set docker0 subpool as the IPAM pool
2023-04-25 11:07:57 -07:00
Sebastiaan van Stijn
801202349a
Merge pull request #45387 from cuishuang/master
fix some comments
2023-04-25 16:31:22 +02:00
Albin Kerouanton
2d31697d82
daemon: set docker0 subpool as the IPAM pool
Since cc19eba (backported to v23.0.4), the PreferredPool for docker0 is
set only when the user provides the bip config parameter or when the
default bridge already exist. That means, if a user provides the
fixed-cidr parameter on a fresh install or reboot their computer/server
without bip set, dockerd throw the following error when it starts:

> failed to start daemon: Error initializing network controller: Error
> creating default "bridge" network: failed to parse pool request for
> address space "LocalDefault" pool "" subpool "100.64.0.0/26": Invalid
> Address SubPool

See #45356.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-04-25 15:32:46 +02:00
Sebastiaan van Stijn
d8b784a15e
daemon/cluster: inline filters
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-25 15:17:44 +02:00
Sebastiaan van Stijn
5bc0832766
daemon: inline filters in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-25 15:13:26 +02:00
Sebastiaan van Stijn
a343ed13e5
Merge pull request #45390 from vvoland/c8d-imagelist-fix-rootlen
c8d/list: Initialize capacity instead of length
2023-04-25 12:26:41 +02:00
Sebastiaan van Stijn
ed7b2a64f8
Merge pull request #45368 from thaJeztah/remove_overlay2.override_kernel_check
overlay2: remove deprecated overlay2.override_kernel_check option
2023-04-25 12:12:15 +02:00
Sebastiaan van Stijn
fd03a52468
Merge pull request #45294 from vvoland/builder-fix-prune-timestamp
builder-next/prune: Handle `until` filter timestamps
2023-04-25 11:19:27 +02:00
Paweł Gronowski
391f9635cc
c8d/list: Initialize capacity instead of length
The slice which stores chain ids used for computing shared size was
mistakenly initialized with the length set instead of the capacity.
This caused a panic when iterating over it later and dereferncing nil
pointer from empty items.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-25 10:38:23 +02:00
cui fliter
f66684fdeb fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-04-25 13:39:28 +08:00
Laura Brehm
8df3db4b97
c8d: add support for removing images by shortID
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-04-21 10:30:53 +01:00
Paweł Gronowski
117ceac82b
daemon/prune: Use errdefs for invalid "until" value
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-21 10:25:57 +02:00
Sebastiaan van Stijn
9791756284
overlay2: remove deprecated overlay2.override_kernel_check option
This option was deprecated in e35700eb50
(and backported to v23.0 through 43ce8f7d24).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-20 23:57:45 +02:00
Sebastiaan van Stijn
c33b31116c
daemon/graphdriver: remove isDeprecated() utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-20 23:51:54 +02:00
Sebastiaan van Stijn
dc11d2a2d8
remove deprecated devicemapper storage-driver
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-20 23:51:54 +02:00
Brian Goff
d0df6c983c
Merge pull request #45359 from thaJeztah/remove_deprecated_overlay1
remove deprecated legacy "overlay" storage-driver
2023-04-20 11:08:52 -07:00
Sebastiaan van Stijn
5745ba6a8e
Merge pull request #45354 from thaJeztah/c8d_test_fixes
containerd integration: some test-fixes
2023-04-19 18:58:05 +02:00
Sebastiaan van Stijn
f72548956f
remove deprecated legacy "overlay" storage-driver
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-19 17:06:45 +02:00
Tianon Gravi
bbb94fd499
Merge pull request #45342 from thaJeztah/remove_deprecated_aufs_storage_driver
daemon: remove deprecated AuFS storage driver
2023-04-18 16:05:54 -07:00
Sebastiaan van Stijn
4ecb587eff
daemon: skip TestGetInspectData when using containerd snapshotters
This test does not apply when running with snapshotters enabled;

    go test -v -run TestGetInspectData .
    === RUN   TestGetInspectData
        inspect_test.go:27: RWLayer of container inspect-me is unexpectedly nil
    --- FAIL: TestGetInspectData (0.00s)
    FAIL
    FAIL	github.com/docker/docker/daemon	0.049s
    FAIL

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-18 15:02:41 +02:00
Sebastiaan van Stijn
a82c434447
daemon: setupFakeDaemon(): add fakeImageService
To prevent a panic happening when running tests:

    === FAIL: daemon TestTmpfsDevShmNoDupMount (0.01s)
    panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x120 pc=0x261a373]

    goroutine 134 [running]:
    testing.tRunner.func1.2({0x28baf20, 0x3ea8000})
        /usr/local/go/src/testing/testing.go:1526 +0x24e
    testing.tRunner.func1()
        /usr/local/go/src/testing/testing.go:1529 +0x39f
    panic({0x28baf20, 0x3ea8000})
        /usr/local/go/src/runtime/panic.go:884 +0x213
    github.com/docker/docker/daemon.(*Daemon).createSpec(0xc0006e0000, {0x2ea5588, 0xc00012a008}, 0xc0003b5900)
        /go/src/github.com/docker/docker/daemon/oci_linux.go:1060 +0xf33
    github.com/docker/docker/daemon.TestTmpfsDevShmNoDupMount(0xc000b781a0?)
        /go/src/github.com/docker/docker/daemon/oci_linux_test.go:77 +0x20a
    testing.tRunner(0xc000b78340, 0x2c74210)
        /usr/local/go/src/testing/testing.go:1576 +0x10b
    created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:1629 +0x3ea

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-18 15:02:41 +02:00
Sebastiaan van Stijn
1261fe69a3
API: deprecate VirtualSize field for /images/json and /images/{id}/json
In versions of Docker before v1.10, this field was calculated from
the image itself and all of its parent images. Images are now stored
self-contained, and no longer use a parent-chain, making this field
an equivalent of the Size field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-18 14:46:11 +02:00
Sebastiaan van Stijn
20a1d23b39
Merge pull request #45320 from akerouanton/info-no-new-privileges
Add no-new-privileges to SecurityOptions returned by /info
2023-04-18 14:37:15 +02:00
Albin Kerouanton
eb7738221c
Add no-new-privileges to SecurityOptions returned by /info
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-04-18 09:34:08 +02:00
Sebastiaan van Stijn
e7980275c0
c8d: align "Size" and "VirtualSize" for images
In versions of Docker before v1.10, this field was calculated from
the image itself and all of its parent images. Images are now stored
self-contained, and no longer use a parent-chain, making this field
an equivalent of the Size field.

For the containerd integration, the Size should be the sum of the
image's compressed / packaged and unpacked (snapshots) layers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-17 22:39:00 +02:00
Sebastiaan van Stijn
3903f16cd6
daemon: remove deprecated AuFS storage driver
There's still some locations refering to AuFS;

- pkg/archive: I suspect most of that code is because the whiteout-files
  are modelled after aufs (but possibly some code is only relevant to
  images created with AuFS as storage driver; to be looked into).
- contrib/apparmor/template: likely some rules can be removed
- contrib/dockerize-disk.sh: very old contribution, and unlikely used
  by anyone, but perhaps could be updated if we want to (or just removed).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-15 01:27:16 +02:00
Sebastiaan van Stijn
5bf405b2af
Merge pull request #45227 from PettitWesley/fix-awslogs-non-blocking
awslogs: fix non-blocking log drop bug
2023-04-15 00:56:57 +02:00
Djordje Lukic
bc37e3f830
Fix returning errors from snapshotter.Prepare
In the case of an error when calling snapshotter.Prepare we would return
nil. This change fixes that and returns the error from Prepare all the
time.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-04-14 10:10:52 +02:00
Sebastiaan van Stijn
d69f9fe266
Merge pull request #45270 from vvoland/c8d-prune-upstream
c8d: Implement prune
2023-04-14 02:29:38 +02:00
Sebastiaan van Stijn
61656464d8
Merge pull request #45315 from thaJeztah/deprecate_oom_score_adjust
daemon: deprecate --oom-score-adjust for the daemon
2023-04-14 00:06:58 +02:00
Paweł Gronowski
f846349824
c8d/list: Implement until filter
It's not originally supported by image list, but we need it for `prune`
needs it, so `list` gets it for free.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-13 20:30:29 +02:00
Paweł Gronowski
d89590eab9
c8d: Implement prune
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-13 20:30:27 +02:00
Sebastiaan van Stijn
9bc78bdc5b
Merge pull request #45289 from vvoland/c8d-label-filter
c8d/list: Fix `label` (and add `label!`) filter
2023-04-13 18:01:23 +02:00
Sebastiaan van Stijn
93e5c99fff
Merge pull request #45324 from vvoland/image-children-error
images/Children: Return error
2023-04-13 18:00:47 +02:00
Sebastiaan van Stijn
9b83875c13
Merge pull request #45300 from thaJeztah/errdefs_alias
use consistent alias for containerd's errdefs package, and validate in CI
2023-04-13 16:20:49 +02:00
Paweł Gronowski
9cb5da400c
images/Children: Return error
Change return value in function signature and return fatal errors so
they can actually be reported to the caller instead of just being logged
to daemon log.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-13 16:20:02 +02:00
Sebastiaan van Stijn
45483a1d0d
Merge pull request #45299 from thaJeztah/cleanup_stats
daemon: move code related to stats together
2023-04-13 16:16:47 +02:00
Paweł Gronowski
edf802956e
c8d/list: Implement label and label! filter
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-13 15:39:52 +02:00
Sebastiaan van Stijn
5a922dc162
daemon: deprecate --oom-score-adjust for the daemon
The `oom-score-adjust` option was added in a894aec8d8,
to prevent the daemon from being OOM-killed before other processes. This
option was mostly added as a "convenience", as running the daemon as a
systemd unit was not yet common.

Having the daemon set its own limits is not best-practice, and something
better handled by the process-manager starting the daemon.

Commit cf7a5be0f2 fixed this option to allow
disabling it, and 2b8e68ef06 removed the default
score adjust.

This patch deprecates the option altogether, recommending users to set these
limits through the process manager used, such as the "OOMScoreAdjust" option
in systemd units.

With this patch:

    dockerd --oom-score-adjust=-500 --validate
    Flag --oom-score-adjust has been deprecated, and will be removed in the next release.
    configuration OK

    echo '{"oom-score-adjust":-500}' > /etc/docker/daemon.json
    dockerd
    INFO[2023-04-12T21:34:51.133389627Z] Starting up
    INFO[2023-04-12T21:34:51.135607544Z] containerd not running, starting managed containerd
    WARN[2023-04-12T21:34:51.135629086Z] DEPRECATED: The "oom-score-adjust" config parameter and the dockerd "--oom-score-adjust" option will be removed in the next release.

    docker info
    Client:
      Context:    default
      Debug Mode: false
    ...
    DEPRECATED: The "oom-score-adjust" config parameter and the dockerd "--oom-score-adjust" option will be removed in the next release

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-13 00:02:39 +02:00
Djordje Lukic
f696a1b3b3
Fix error checking when pulling from an insecure registry
The call to an unsecure registry doesn't return an error saying that the
"server gave an HTTP response to an HTTPS client" but a
tls.RecordHeaderError saying that the "first record does not look like a
TLS handshake", this changeset looks for the right error for that case.

This fixes the http fallback when using an insecure registry

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-04-12 21:56:52 +02:00
Sebastiaan van Stijn
860db986fc
Merge pull request #45267 from rumpl/c8d-fix-exec-user
c8d: Set the process user on exec
2023-04-11 16:03:40 +02:00
Sebastiaan van Stijn
74a0fdf961
Merge pull request #45265 from vvoland/c8d-children-upstream
c8d: Implement Children by comparing diff ids
2023-04-11 15:45:27 +02:00
Sebastiaan van Stijn
a5d46a15f5
split GetRepository from ImageService
The GetRepository method interacts directly with the registry, and does
not depend on the snapshotter, but is used for two purposes;

For the GET /distribution/{name:.*}/json route;
dd3b71d17c/api/server/router/distribution/backend.go (L11-L15)

And to satisfy the "executor.ImageBackend" interface as used by Swarm;
58c027ac8b/daemon/cluster/executor/backend.go (L77)

This patch removes the method from the ImageService interface, and instead
implements it through an composite struct that satisfies both interfaces,
and an ImageBackend() method is added to the daemon.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

remove GetRepository from ImageService

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-09 12:07:57 +02:00
Sebastiaan van Stijn
81e62af94a
use consistent alias for containerd's errdefs package
The signatures of functions in containerd's errdefs packages are very
similar to those in our own, and it's easy to accidentally use the wrong
package.

This patch uses a consistent alias for all occurrences of this import.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-08 19:30:33 +02:00
Sebastiaan van Stijn
f691b13450
daemon: move code related to stats together
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-08 19:00:01 +02:00
Sebastiaan van Stijn
5c78cbd3be
pkg/platform: deprecate OSType in favor or runtime.GOOS
This const looks to only be there for "convenience", or _possibly_ was created
with future normalization or special handling in mind.

In either case, currently it is just a direct copy (alias) for runtime.GOOS,
and defining our own type for this gives the impression that it's more than
that. It's only used in a single place, and there's no external consumers, so
let's deprecate this const, and use runtime.GOOS instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-08 14:57:33 +02:00
Djordje Lukic
41a230758c
c8d: Set the process user on exec
This change makes is possible to run `docker exec -u <UID> ...` when the
containerd integration is activated.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-04-07 10:53:25 +02:00
Sebastiaan van Stijn
79bf167c0d
Merge pull request #45269 from vvoland/c8d-reference-filter
c8d/list: Implement `reference`
2023-04-06 23:30:55 +02:00
Paweł Gronowski
e0f36f9d8b
ImageService: Pass ctx to Children
This only makes the containerd ImageService implementation respect
context cancellation though.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-06 14:27:38 +02:00
Paweł Gronowski
bea751beb7
c8d: Implement Children by comparing diff ids
Implement Children method for containerd image store which makes the
`ancestor` filter work for `docker ps`. Checking if image is a children
of other image is implemented by comparing their rootfs diffids because
containerd image store doesn't have a concept of image parentship like
the graphdriver store. The child is expected to have more layers than
the parent and should start with all parent layers.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-06 14:27:37 +02:00
Paweł Gronowski
ba47cdcc0b
c8d/list: Implement reference filter
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-06 13:44:52 +02:00
Sebastiaan van Stijn
e8a79114b8
Merge pull request #45274 from thaJeztah/container_as_source_of_truth
c8d: use the container's configured snapshotter where possible
2023-04-05 17:03:18 +02:00
Sebastiaan van Stijn
465cbccdaf
c8d: use the container's configured snapshotter where possible
While we currently do not provide an option to specify the snapshotter to use
for individual containers (we may want to add this option in future), currently
it already is possible to configure the snapshotter in the daemon configuration,
which could (likely) cause issues when changing and restarting the daemon.

This patch updates some code-paths that have the container available to use
the snapshotter that's configured for the container (instead of the default
snapshotter configured).

There are still code-paths to be looked into, and a tracking ticket as well as
some TODO's were added for those.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-05 14:09:21 +02:00
Sebastiaan van Stijn
c2c83e16a2
Merge pull request #45266 from rumpl/c8d-tag-delete-events
c8d: Send an event when an image is tagged or deleted
2023-04-05 09:10:43 +02:00
Wesley Pettit
c8f8d11ac4
awslogs: fix non-blocking log drop bug
Previously, the AWSLogs driver attempted to implement
non-blocking itself. Non-blocking is supposed to
implemented solely by the Docker RingBuffer that
wraps the log driver.

Please see issue and explanation here:
https://github.com/moby/moby/issues/45217

Signed-off-by: Wesley Pettit <wppttt@amazon.com>
2023-04-04 17:03:06 -07:00
Djordje Lukic
1b178dffa3
Send an event when an image is deleted
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-04-04 15:54:11 +02:00
Djordje Lukic
36d28b73fc
Send an event when an image is tagged
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-04-04 11:32:02 +02:00
Cory Snider
750218c5e5 d/config: fix default-network-opts in daemon.json
Prevent the daemon from erroring out if daemon.json contains default
network options for network drivers aside from bridge. Configuring
defaults for the bridge driver previously worked by coincidence because
the unrelated CLI flag '--bridge' exists.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-04-03 15:59:53 -04:00
Sebastiaan van Stijn
816cd9802f
Merge pull request #45259 from rumpl/c8d-load-save-events
c8d: Send event when an image is imported
2023-04-03 20:05:45 +02:00
Sebastiaan van Stijn
781740c19d
Merge pull request #45124 from vvoland/c8d-list-ignore-attestations
c8d/list: Ignore attestation manifests
2023-04-03 19:56:29 +02:00
Paweł Gronowski
92e38b6e27
c8d/list: Ignore attestation manifests
Attestation manifests have an OCI image media type, which makes them
being listed like they were a separate platform supported by the image.

Don't use `images.Platforms` and walk the manifest list ourselves
looking for all manifests that are an actual image manifest.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-03 17:50:56 +02:00
Djordje Lukic
773a9d85a1
c8d: Send event when an image is exported
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-04-03 15:30:04 +02:00
Djordje Lukic
00545ef4d6
c8d: Send event when an image is imported
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-04-03 15:21:18 +02:00
Sebastiaan van Stijn
348f83670a
Merge pull request #45249 from vvoland/c8d-push-upstream-2
c8d/push: Follow up fixes
2023-03-31 22:37:59 +02:00
Sebastiaan van Stijn
126e212fb0
Merge pull request #45243 from thaJeztah/c8d_push_nits
c8d: push: addressing some nits
2023-03-31 19:28:43 +02:00
Paweł Gronowski
027f70562e
c8d/push: Rename jobs to avoid shadowing type
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-31 16:30:14 +02:00
Paweł Gronowski
e1dd9c0396
c8d/push: Ignore :port when comparing source repository
Distribution source labels don't store port of the repository. If the
content was obtained from repository 172.17.0.2:5000 then its
corresponding label will have a key "containerd.io/distribution.source.172.17.0.2".

Fix the check in canBeMounted to ignore the :port part of the domain.

This also removes the check which prevented insecure repositories to use
cross-repo mount - the real cause was the mismatch in domain comparison.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-31 16:30:11 +02:00
Paweł Gronowski
4a34c501c1
c8d/push: Parse source labels with multiple sources
Distribution source label can specify multiple repositories - in this
case value is a comma separated list of source repositories.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-31 16:30:09 +02:00
Paweł Gronowski
cb788bea9c
c8d/push: Add distribution source labels only on success
Previously the labels would be appended for content that was pushed
even if subsequent pushes of other content failed.
Change the behavior to only append the labels if the whole push
operation succeeded.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-31 16:30:08 +02:00
Paweł Gronowski
013e44ec5d
c8d/push: Log error if releasing the lease failed
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-31 16:30:06 +02:00
Paweł Gronowski
c9012c798e
c8d/push: Sync mountableBlobs access
Handler is called in parallel and modifying a map without
synchronization is a race condition.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-03-31 16:30:03 +02:00
Sebastiaan van Stijn
7c93e4a09b
Merge pull request #45241 from rumpl/c8d-image-events
c8d: Add the events services to the containerd image service
2023-03-31 00:31:04 +02:00
Sebastiaan van Stijn
a0ef2ac59c
c8d: push: addressing some nits
- make jobs.Add accept a list of jobs, so that we don't have to
  repeatedly lock/unlock the mutex
- rename some variables that collided with imports or types

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-31 00:23:09 +02:00
Tianon Gravi
f537ef5746
Merge pull request #44963 from vvoland/c8d-push-upstream
c8d: Implement push
2023-03-30 14:43:41 -07:00