Commit Graph

8386 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
2ce811e632 migrate to github.com/moby/sys/user/userns
The userns package in libcontainer was integrated into the moby/sys/user
module at commit [3778ae603c706494fd1e2c2faf83b406e38d687d][1].

The userns package is used in many places, and currently either depends
on runc/libcontainer, or on containerd, both of which have a complex
dependency tree. This patch is part of a series of patches to unify the
implementations, and to migrate toward that implementation to simplify
the dependency tree.

[1]: 3778ae603c

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-25 12:47:34 +02:00
Sebastiaan van Stijn
f39409f80d Merge pull request #48078 from vvoland/c8d-buildkit-tag-event
c8d/build: Log `image tag` event when image was built with Buildkit
2024-07-18 21:46:49 +02:00
Kir Kolyshkin
508939821b daemon/containerd: rm use of regexp
Replace the regexp check with a function.

Keep the use of regexp.QuoteMeta.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-07-16 13:06:01 -07:00
Sebastiaan van Stijn
fb5acc4377 Merge pull request #48143 from thaJeztah/graphdriver_remove_capabilities
daemon/graphdriver: remove Capabilities, CapabilityDriver
2024-07-15 21:25:24 +02:00
Sebastiaan van Stijn
20a0102c5f Merge pull request #48139 from corhere/go119atomics
all: switch to Go 1.19 atomics
2024-07-15 18:03:41 +02:00
Sebastiaan van Stijn
688301caf4 daemon/graphdriver: remove Capabilities, CapabilityDriver
Capabilities were implemented in aa96c3176b,
as part of work on an external graphdriver-plugin. Given that none of
the builtin graphdrivers use this option, and support for graphdriver-
plugins has been removed in 555dac5e14,
we can remove this functionality.

This patch:

- removes the CapabilityDriver interface, which has no implementations
- removes the Capabilities type
- layer: remove layerStore.useTarSplit. This field was previously set
  through the driver's Capabilities, but always enabled for the builtin
  graphdrivers,

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-08 18:23:21 -05:00
Sebastiaan van Stijn
c4dcaa0d9a Merge pull request #48092 from thaJeztah/fsmagic_internal
daemon/graphdriver: split, internalize packages to separate snapshotters and graphdrivers
2024-07-08 16:09:59 -05:00
Cory Snider
2ab618696a daemon/images: switch to Go 1.19 atomics
Signed-off-by: Cory Snider <csnider@mirantis.com>
2024-07-05 19:05:22 -04:00
Cory Snider
30d740ada0 daemon/logger/ring: switch to Go 1.19 atomics
Signed-off-by: Cory Snider <csnider@mirantis.com>
2024-07-05 19:05:18 -04:00
Cory Snider
7ef0c7acbe d/logger/loggerutils: switch to Go 1.19 atomics
Signed-off-by: Cory Snider <csnider@mirantis.com>
2024-07-05 19:05:18 -04:00
Cory Snider
e612990994 daemon/logger/journald: switch to Go 1.19 atomics
Signed-off-by: Cory Snider <csnider@mirantis.com>
2024-07-05 19:05:15 -04:00
Cory Snider
78893cdc05 daemon/logger/gcplogs: switch to Go 1.19 atomics
Signed-off-by: Cory Snider <csnider@mirantis.com>
2024-07-05 19:05:15 -04:00
Cory Snider
508f51044d daemon/containerd: switch to Go 1.19 atomics
Signed-off-by: Cory Snider <csnider@mirantis.com>
2024-07-05 19:05:15 -04:00
Cory Snider
71a299ff6a daemon: switch to Go 1.19 atomics
Signed-off-by: Cory Snider <csnider@mirantis.com>
2024-07-05 19:05:15 -04:00
Akihiro Suda
1205a90733 Merge pull request #47142 from thaJeztah/migrate_to_platforms_module
vendor: github.com/containerd/containerd v1.7.19, migrate to github.com/containerd/platforms module
2024-07-04 10:59:16 +09:00
Sebastiaan van Stijn
fb18966aa5 api/types/container: InspectResponse: keep old name for embedded type
This is a follow-up to 1abc8f6158, which
moved the ContainerJSONBase to api/types/container, but also renamed it
to container.InspectBase. This field is embedded into the InspectResponse
type, which meant that renaming the type also implicitly renamed the
field when creating this type from a struct-literal.

While we're planning to merge these types (which would be a breaking
change for users constructing it through struct-literals), let's keep
it backward-compatible for now (other than deprecating the old names).

We can continue the other changes separately.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-03 17:14:03 +02:00
Sebastiaan van Stijn
d0aa3eaccf Migrate to github.com/containerd/platforms module
Switch to use github.com/containerd/platforms module, because containerd's
platforms package has moved to a separate module. This allows updating the
platforms parsing independent of the containerd module itself.

The package in containerd is deprecated, but kept as an alias to provide
compatibility between codebases.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 21:20:29 +02:00
Sebastiaan van Stijn
73979f3f04 daemon/logger/journald: add //nolint:unused for readSyncTimeout
Same applies to this field as for journalReadDir above it.

    daemon/logger/journald/journald.go:66:2: field `readSyncTimeout` is unused (unused)
        readSyncTimeout time.Duration
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 20:00:57 +02:00
Sebastiaan van Stijn
1abc8f6158 api/types: move container-inspect types to api/types/container
This moves the `ContainerJSONBase`, `ContainerJSON` and `ContainerNode`
types to the api/types/container package and deprecates the old location.

- `ContainerJSONBase` was renamed to `InspectBase`
- `ContainerJSON` was rnamed to `InspectResponse`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 12:50:24 +02:00
Sebastiaan van Stijn
05b0e653dd api/types: move Container to api/types/container
This moves the `Container` type to the containere package, rename
it to `Summary`, and deprecates the old location.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 12:46:48 +02:00
Sebastiaan van Stijn
84ffc644ef api/types: move ContainerState to api/types/image
This moves the `ContainerState` type to the container package,
renames it to `State`, and deprecates the old location.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 12:46:48 +02:00
Sebastiaan van Stijn
5517322cf9 api/types: move MountPoint to api/types/container
This moves the `MountPoint` type to the container package, and
deprecates the old location.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 12:46:47 +02:00
Sebastiaan van Stijn
c130ce1f5d api/types: move container Health types to api/types/container
This moves the `Health` and `HealthcheckResult` types to the container package,
as well as the related `NoHealthcheck`, `Starting`, `Healthy`, and `Unhealthy`
consts.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 12:46:47 +02:00
Sebastiaan van Stijn
df22a511cb api/types: move container-networksettings types to api/types/container
This moves the NetworkSettings, NetworkSettingsBase, DefaultNetworkSettings,
and SummaryNetworkSettings types to the api/types/container package, and
deprecates the old location.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-02 12:46:45 +02:00
Paweł Gronowski
53bc396ef4 c8d/build: Log image tag event when image was built with Buildkit
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-07-02 12:34:53 +02:00
Paweł Gronowski
bce76d486e builder-next: Don't return error from exported callback
This is only a callback that notifies about event so there is no way to
react to the error.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-07-02 12:34:51 +02:00
Akihiro Suda
7083f1fb55 Merge pull request #48108 from thaJeztah/internalize_pkg_directory
pkg/directory: deprecate, and move to internal
2024-07-02 15:52:56 +09:00
Sebastiaan van Stijn
0f3273e71a daemon/graphdriver: move RefCounter to an internal package
The RefCounter is used in both graphdrivers and snapshotters. Move it
to a separate package to help decoupling snapshotters and graphdrivers,
and make it internal, as it's not intended to be used as a generic utility
package (we can still make it public if there would be a need).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-01 23:53:28 +02:00
Sebastiaan van Stijn
efdaca2792 pkg/rootless/specconv: move to internal
This package is only used by the daemon, so move it to the internal
rootless package instead.

Note that technically this could be in daemon/internal, but as there's
already an existing internal/rootless package (which needs to be in the
top-level internal package because it's also used by /plugin), I'm moving
it there.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-01 21:05:19 +02:00
Sebastiaan van Stijn
3a3bb1cb50 pkg/directory: deprecate, and move to internal
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-01 20:44:31 +02:00
Sebastiaan van Stijn
e55897977c daemon/graphdriver: simplify Checker, remove NewFsChecker, NewDefaultChecker
The Checker interface was introduced in 1ba05cdb6a
as an optimization to allow passing a simplified check for situations that
don't require mountinfo.Mounted to be executed (as that may result in parsing
 `/proc/self/mountinfo`).

The Checker was defined as an interface with a single `IsMounted` method,
possibly with the intent to allow for additional kind of checks to be added.
No new additions were made since its inception 9 Years ago, and if a need would
arrive, could probably be implemented as part of the check.

This patch simplifies the definition to a function, removing the need to
implement a wrapper struct just to satisfy the interface. The `Checker`
type definition is somewhat redundant, but is kept to have a place to
provide GoDoc.

The `NewFsChecker` and `NewDefaultChecker` utilities are removed as part
of this change, favoring a local definition for storage-drivers that
used them.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-01 19:15:26 +02:00
Sebastiaan van Stijn
554db8f113 daemon/internal/fstype: make FsMagic values not platform-dependent
While detection of filesystem-types may not be supported on all platforms,
it should be ok to define the types; this would allow for these types to
be used to print names (e.g.) in cross-platform situations.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-01 19:15:26 +02:00
Sebastiaan van Stijn
49f6e004f1 daemon/graphdriver: move FsMagic utilities to an internal package
These utilities were used in both graphdrivers and snapshotters. Move them
to a separate package, to help decoupling snapshotters and graphdrivers,
and make it internal, as it's not intended to be used as a generic utility
package (we can still make it public if there would be a need).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-01 19:15:20 +02:00
Brian Goff
f3d377e422 Merge pull request #48097 from thaJeztah/internalize_containerfs
pkg/containerfs: move to internal
2024-07-01 16:09:48 +00:00
Paweł Gronowski
2427c4bf92 Merge pull request #48101 from thaJeztah/capabilities_internal
pkg/capabilities move to daemon/internal
2024-07-01 17:40:09 +02:00
Sebastiaan van Stijn
c0dd5c18f6 Merge pull request #48081 from thaJeztah/gofumpt
do another run of gofumpt
2024-07-01 16:17:54 +02:00
Sebastiaan van Stijn
d80a3f2e48 pkg/capabilities move to daemon/internal
This package was added in 8f936ae8cf, and
never had external consumers. Let's move it internal.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-01 00:49:15 +02:00
Sebastiaan van Stijn
81be279c6b daemon/logger, volume/drivers: remove redundant import-aliases
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-30 19:22:17 +02:00
Sebastiaan van Stijn
f2970e5358 pkg/containerfs: move to internal
The only external consumer are the `graphdriver` and `graphdriver/shim`
packages in github.com/docker/go-plugins-helpers, which depended on
[ContainerFS][1], which was removed in 9ce2b30b81.

graphdriver-plugins were deprecated in 6da604aa6a,
and support for them removed in 555dac5e14,
so removing this should not be an issue.

Ideally this package would've been moved inside `daemon/internal`, but it's used
by the `daemon` (cleanupContainer), `plugin` package, and by `graphdrivers`,
so needs to be in the top-level `internal/` package.

[1]: 6eecb7beb6/graphdriver/api.go (L218)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-30 19:13:23 +02:00
Sebastiaan van Stijn
0d16821922 Merge pull request #48083 from thaJeztah/fix_rootless_pull
daemon/graphdriver/overlay2: set TarOptions.InUserNS for native differ (fix "failed to Lchown "/dev/console")
2024-06-28 19:33:15 +02:00
Sebastiaan van Stijn
6226988c1e Merge pull request #48080 from thaJeztah/gofmt
fix some gofmt issues reported by goreportcard
2024-06-28 17:04:04 +02:00
Sebastiaan van Stijn
6521057bb2 daemon/graphdriver/overlay2: set TarOptions.InUserNS for native differ
Commits b2fd67de77 (and the follow-up commit
f6b80253b8) updated doesSupportNativeDiff to
detect whether the host can support native overlay diffing with userns
enabled.

As a result, [useNaiveDiff] would now return "false" in cases where it
previously would return "true" (and thus skip). However, [overlay2],
unlike [fuse-overlay] did not take user namespaces into account, when
using the native differ, and it therefore did not set the InUserNS option
in TarOptions.

As a result pkg/archive.createTarFile would attempt tocreate [device-nodes]
through [handleTarTypeBlockCharFifo] which would fail, but the resulting
error `EPERM` would be discarded, and `createTarFile` would not return
early, therefor attempting to [os.LChown] the missing file, ultimately
resulting in an error:

    failed to Lchown "/dev/console" for UID 0, GID 0: lchown /dev/console: no such file or directory

This patch fixes the missing option in overlay.

[useNaiveDiff]: 47eebd718f/daemon/graphdriver/overlay2/overlay.go (L248-L256)
[overlay2]: 47eebd718f/daemon/graphdriver/overlay2/overlay.go (L684-L689)
[fuse-overlay]: 47eebd718f/daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go (L456-L462)
[device-nodes]: ff1e2c0de7/pkg/archive/archive.go (L713-L720)
[handleTarTypeBlockCharFifo]: 47eebd718f/pkg/archive/archive_unix.go (L110-L114)
[os.LChown]: ff1e2c0de7/pkg/archive/archive.go (L762-L773)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-28 12:38:40 +02:00
Sebastiaan van Stijn
e765dd90ee daemon: gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-27 23:18:47 +02:00
Sebastiaan van Stijn
181101c4a8 daemon/containerd: gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-27 23:18:47 +02:00
Sebastiaan van Stijn
46b0102da4 daemon/config: gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-27 23:18:47 +02:00
Sebastiaan van Stijn
6ada1cff02 fix some gofmt issues reported by goreportcard
https://goreportcard.com/report/github.com/docker/docker

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-27 23:02:00 +02:00
Sebastiaan van Stijn
84cabde357 daemon/graphdriver: deprecate GetDriver(), and remove its use
The exported function was only used in tests, and identical in use when
using New with a name provided. Deprecate it, and remove the uses of it
in our (integration-)tests.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-27 20:05:44 +02:00
Sebastiaan van Stijn
b7896056c1 daemon/graphdriver: New(): update GoDoc
Better describe what this function does (currently), and add a TODO for
consideration to extract some of its magic.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-27 20:05:43 +02:00
Sebastiaan van Stijn
25d12b54d3 daemon/graphdriver: combine GetDriver and getBuiltinDriver
Now that support for external graphdriver-plugins is removed, these functions
are now identical in functionality; combine them, but use a non-exported
variant for internal use to get visibility into where it's used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-27 20:05:38 +02:00
Paweł Gronowski
47eebd718f Merge pull request #48072 from thaJeztah/remove_graphdriver_plugins
daemon/graphdriver: remove support for external graphdriver plugins
2024-06-27 19:53:32 +02:00