Commit graph

44947 commits

Author SHA1 Message Date
John Howard
81ccfd44e4 Fix grammar in README.md
Signed-off-by: John Howard <john@lowenna.com>
2022-11-10 19:49:41 +00:00
Sebastiaan van Stijn
7bbf2fb652
Merge pull request #44428 from thaJeztah/fix_usage_of_deprecated_funcs
Remove uses of deprecated go-digest.NewDigestFromHex, go-digest.Digest.Hex
2022-11-10 17:52:43 +01:00
Sebastiaan van Stijn
3b84630e14
Merge pull request #44427 from thaJeztah/swap_digestset
replace distribution/digestset with opencontainers/go-digest/digestset
2022-11-09 14:14:14 +01:00
Sebastiaan van Stijn
5ecb161850
Merge pull request #44417 from thaJeztah/bump_gotest_tools
vendor: gotest.tools/v3 v3.4.0,  github.com/google/go-cmp v0.5.9, remove  golang.org/x/xerrors
2022-11-09 13:49:56 +01:00
Sebastiaan van Stijn
0f7c9cd27e
Remove uses of deprecated go-digest.NewDigestFromHex, go-digest.Digest.Hex
Both of these were deprecated in 55f675811a,
but the format of the GoDoc comments didn't follow the correct format, which
caused them not being picked up by tools as "deprecated".

This patch updates uses in the codebase to use the alternatives.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-08 16:42:13 +01:00
Sebastiaan van Stijn
6174d00c03
replace distribution/digestset with opencontainers/go-digest/digestset
opencontainers/go-digest is a 1:1 copy of the one in distribution. It's no
longer used in distribution itself, so may be removed there at some point.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-08 14:15:13 +01:00
Sebastiaan van Stijn
d43bc26717
vendor: gotest.tools/v3 v3.4.0
- removes github.com/spf13/pflag dependency
- removes use of deprecated io/ioutil package
- drops support for go1.16

full diff: https://github.com/gotestyourself/gotest.tools/compare/v3.3.0...v3.4.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-05 19:38:01 +01:00
Sebastiaan van Stijn
57ba2df970
vendor: github.com/google/go-cmp v0.5.9 to remove golang.org/x/xerrors dep
full diff: https://github.com/google/go-cmp/compare/v0.5.7...v0.5.9

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-05 19:21:36 +01:00
Sebastiaan van Stijn
4f3c5b2568
Merge pull request #44304 from thaJeztah/sys_move_process
pkg/system: move process-functions to pkg/process, improve pkg/pidfile and reduce overlap
2022-11-05 18:41:32 +01:00
Cory Snider
781b7d4820
Merge pull request #44407 from corhere/fix-libnetwork-parallel-tests
Fix libnetwork `TestParallel` tests
2022-11-04 19:07:48 -04:00
Cory Snider
f39b83e232 libnetwork: fix TestParallel "bad file descriptor"
When running inside a container, testns == origns. Consequently, closing
testns causes the deferred netns.Set(origns) call to fail. Stop closing
the aliased original namespace handle.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2022-11-04 14:07:54 -04:00
Cory Snider
fe6706a2ce libnetwork: make tests less dependent on others
TestResolvConfHost and TestParallel both depended on a network named
"testhost" already existing in the libnetwork controller. Only TestHost
created that network, so the aforementioned tests would fail unless run
after TestHost. Fix those tests so they can be run in any order.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2022-11-04 13:55:26 -04:00
Sebastiaan van Stijn
cea8e9b583
libcontainerd/supervisor: use pkg/pidfile for reading and writing pidfile
Also updated a variable name that collided with a package const.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-04 01:50:26 +01:00
Sebastiaan van Stijn
14da1bfe40
cmd/dockerd: adjust error message for pidfile changes
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-04 01:50:26 +01:00
Sebastiaan van Stijn
7493debe26
pkg/pidfile: implement Read()
This allows consumers to read back the pidFile and to check if the
PID is still running.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-04 01:50:26 +01:00
Sebastiaan van Stijn
7d3e1ad943
pkg/pidfile: Write(): don't automatically create parent directories
While this was convenient for our use, it's somewhat unexpected for a function
that writes a file to also create all parent directories; even more because
this function may be executed as root.

This patch makes the package more "safe" to use as a generic package by removing
this functionality, and leaving it up to the caller to create parent directories,
if needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-04 01:50:26 +01:00
Sebastiaan van Stijn
81945da0ac
pkg/pidfile: Write(): take pid as argument
This allows it to be used for processes other than the daemon itself.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-04 01:50:26 +01:00
Sebastiaan van Stijn
735e250326
pkg/process: Alive(): fix PID 0, -1, negative values
unix.Kill() does not produce an error for PID 0, -1. As a result, checking
process.Alive() would return "true" for both 0 and -1 on macOS (and previously
on Linux as well).

Let's shortcut these values to consider them "not alive", to prevent someone
trying to kill them.

A basic test was added to check the behavior.

Given that the intent of these functions is to handle single processes, this patch
also prevents 0 and negative values to be used.

From KILL(2): https://man7.org/linux/man-pages/man2/kill.2.html

    If pid is positive, then signal sig is sent to the process with
    the ID specified by pid.

    If pid equals 0, then sig is sent to every process in the process
    group of the calling process.

    If pid equals -1, then sig is sent to every process for which the
    calling process has permission to send signals, except for
    process 1 (init), but see below.

    If pid is less than -1, then sig is sent to every process in the
    process group whose ID is -pid.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-04 01:50:26 +01:00
Sebastiaan van Stijn
55d15e9d05
pkg/pidfile, pkg/process: use single implementation for process alive
Using the implementation from pkg/pidfile for windows, as that implementation
looks to be handling more cases to check if a process is still alive (or to be
considered alive).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-04 01:50:26 +01:00
Sebastiaan van Stijn
9d5e754caa
move pkg/system: process to a separate package
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-04 01:50:23 +01:00
Sebastiaan van Stijn
0040fb93d6
pkg/system: IsProcessZombie() skip conversion to string, use bytes instead
bytes.SplitN() is more performant, and skips having to do the conversion.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-04 01:49:54 +01:00
Sebastiaan van Stijn
970ad4e3c7
pkg/system: IsProcessZombie() ignore "os.ErrNotExist" errors
If the file doesn't exist, the process isn't running, so we should be able
to ignore that.

Also remove an intermediate variable.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-04 01:49:49 +01:00
Sebastiaan van Stijn
8d6da1e100
pkg/system: IsProcessAlive() remove redundant type-cast
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-04 01:48:54 +01:00
Sebastiaan van Stijn
6c829007cc
Merge pull request #44356 from corhere/libnetwork-namespace-correctness
libnetwork: fix restoring thread network namespaces
2022-11-03 22:33:29 +01:00
Sebastiaan van Stijn
e7f034fe4e
Merge pull request #44365 from vvoland/c8d-contexts
imageservice: Add context to various methods
2022-11-03 19:51:39 +01:00
Sebastiaan van Stijn
6bb909f152
Merge pull request #44367 from vvoland/oci-artifacts-error
distribution: Error when pulling OCI artifacts
2022-11-03 19:39:22 +01:00
Cory Snider
2006d9f7d1
cmd/dockerd: Rewrite shutdownDaemon to use context timeout
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2022-11-03 14:31:03 +01:00
Paweł Gronowski
66a0289081
builder: Don't store context in struct
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2022-11-03 12:22:46 +01:00
Paweł Gronowski
a181a825c8
daemon/start: Revert passing ctx to ctr.Start
This caused integration tests to timeout in the CI

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2022-11-03 12:22:44 +01:00
Nicolas De Loof
def549c8f6
imageservice: Add context to various methods
Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2022-11-03 12:22:40 +01:00
Sebastiaan van Stijn
4c07d58592
Merge pull request #44401 from neersighted/swarmkit_revendor
vendor: github.com/moby/swarmkit/v2 v2.0.0-20221102165002-6341884e5fc9
2022-11-03 01:01:25 +01:00
Sebastiaan van Stijn
98f36bba9a
Merge pull request #44398 from thaJeztah/daemon_logger_godoc
daemon/logger: fix godoc
2022-11-02 23:50:29 +01:00
Sebastiaan van Stijn
781fd745ed
Merge pull request #44393 from thaJeztah/pkg_kernel_duplicate_docs
pkg/parsers/kernel: remove duplicate GoDoc and un-export Utsname
2022-11-02 23:49:48 +01:00
Bjorn Neergaard
57c2545cd5
vendor: github.com/moby/swarmkit/v2 v2.0.0-20221102165002-6341884e5fc9
full diff: 48dd89375d...6341884e5f

Pulls in a set of fixes to SwarmKit's nascent Cluster Volumes support
discovered during subsequent development and testing.

Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
2022-11-02 15:10:08 -06:00
Sebastiaan van Stijn
2a478f9215
Merge pull request #44399 from corhere/fix-task-delete-on-failed-start
Fix containerd task deletion after failed start
2022-11-02 21:48:56 +01:00
Cory Snider
1bef9e3fbf Fix containerd task deletion after failed start
Deleting a containerd task whose status is Created fails with a
"precondition failed" error. This is because (aside from Windows)
a process is spawned when the task is created, and deleting the task
while the process is running would leak the process if it was allowed.
libcontainerd and the containerd plugin executor mistakenly try to clean
up from a failed start by deleting the created task, which will always
fail with the aforementined error. Change them to pass the
`WithProcessKill` delete option so the cleanup has a chance to succeed.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2022-11-02 13:48:13 -04:00
Sebastiaan van Stijn
be1829f63d
daemon/logger: fix godoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-02 18:47:50 +01:00
Sebastiaan van Stijn
e1743888ed
Merge pull request #44384 from thaJeztah/idtools_cleanup4
pkg/idtools: remove execCmd() utility
2022-11-02 18:46:56 +01:00
Tianon Gravi
b76ccfef5f
Merge pull request #44289 from thaJeztah/windows_refactor_etwlogs
daemon/logger/etwlogs: rewrite to use go-winio/pkg/etw
2022-11-02 10:43:55 -07:00
Sebastiaan van Stijn
9899820a17
Merge pull request #44389 from tianon/debug-typo
Remove errant "runtime.GOARCH" from debug message
2022-11-02 18:23:11 +01:00
Sebastiaan van Stijn
4112481170
Merge pull request #44390 from tianon/rm-deprecated-arm-fallback
Remove long-deprecated "arm" fallback
2022-11-02 18:20:43 +01:00
Sebastiaan van Stijn
5a01c1dad1
Merge pull request #44383 from thaJeztah/improve_example
api/types/filters: add output to example
2022-11-02 17:29:37 +01:00
Brian Goff
8d15e7d742
Merge pull request #44073 from ndeloof/upstream_29
implement docker system df
2022-11-02 08:05:17 -07:00
Paweł Gronowski
407e3a4552
distribution: Error when pulling OCI artifacts
Currently an attempt to pull a reference which resolves to an OCI
artifact (Helm chart for example), results in a bit unrelated error
message `invalid rootfs in image configuration`.

This provides a more meaningful error in case a user attempts to
download a media type which isn't image related.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2022-11-02 12:51:03 +01:00
Sebastiaan van Stijn
4386e3f7c0
pkg/parsers/kernel: un-export Utsname
It's only used internally to allow the "unsupported" stub.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-02 10:55:54 +01:00
Sebastiaan van Stijn
775dcab7a2
pkg/parsers/kernel: remove duplicate Package godoc
It was present both in kernel.go and kernel_unix.go.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-02 10:44:50 +01:00
Nicolas De Loof
8d0dc69027
implement docker system df
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-11-02 09:35:18 +01:00
Samuel Karp
5dd50a381a
Merge pull request #44391 from tlgs/sort-names 2022-11-01 21:37:37 -07:00
Brian Goff
9fa38435aa
Merge pull request #44316 from thaJeztah/plugin_improve_test_errors
integration-cli: DockerPluginSuite: use gotest.tools compare utilities
2022-11-01 17:07:22 -07:00
Tiago Seabra
952e1e62c5 Sort entries in pkg/namesgenerator
Signed-off-by: Tiago Seabra <tlgs@users.noreply.github.com>
2022-11-01 23:13:34 +00:00