Commit graph

6819 commits

Author SHA1 Message Date
Sebastiaan van Stijn
f8795ed364
daemon: allow "builtin" as valid value for seccomp profiles
This allows containers to use the embedded default profile if a different
default is set (e.g. "unconfined") in the daemon configuration. Without this
option, users would have to copy the default profile to a file in order to
use the default.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-07 15:40:47 +02:00
Sebastiaan van Stijn
68e96f88ee
Fix daemon.json and daemon --seccomp-profile not accepting "unconfined"
Commit b237189e6c implemented an option to
set the default seccomp profile in the daemon configuration. When that PR
was reviewed, it was discussed to have the option accept the path to a custom
profile JSON file; https://github.com/moby/moby/pull/26276#issuecomment-253546966

However, in the implementation, the special "unconfined" value was not taken into
account. The "unconfined" value is meant to disable seccomp (more factually:
run with an empty profile).

While it's likely possible to achieve this by creating a file with an an empty
(`{}`) profile, and passing the path to that file, it's inconsistent with the
`--security-opt seccomp=unconfined` option on `docker run` and `docker create`,
which is both confusing, and makes it harder to use (especially on Docker Desktop,
where there's no direct access to the VM's filesystem).

This patch adds the missing check for the special "unconfined" value.

Co-authored-by: Tianon Gravi <admwiggin@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-07 15:40:45 +02:00
Sebastiaan van Stijn
ac449d6b5a
daemon/config: rename the default seccomp profile to "builtin"
Using "default" as a name is a bit ambiguous, because the _daemon_ default
can be changed using the '--seccomp-profile' daemon flag.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-07 15:37:03 +02:00
Sebastiaan van Stijn
ee02257553
Add const for "unconfined" and default seccomp profiles
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-07 15:36:06 +02:00
Sebastiaan van Stijn
5e498e20f7
Merge pull request #42710 from rvolosatovs/parallelize_system_df
daemon: paralellize disk usage computations
2021-08-06 09:55:51 +02:00
Roman Volosatovs
a18cf3e4ef
daemon: paralellize disk usage computations
Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
2021-08-05 14:42:31 +02:00
Sebastiaan van Stijn
0c88b0dc82
Merge pull request #42618 from thaJeztah/remove_common_unix_config
daemon/config: remove commonUnixBridgeConfig and CommonUnixConfig
2021-08-03 16:52:10 +02:00
Sebastiaan van Stijn
656a5e2bdf
Merge pull request #42559 from rvolosatovs/system_df_types
Add `type` parameter to `/system/df`
2021-08-02 21:03:05 +02:00
Brian Goff
51b06c6795
Merge pull request #42683 from thaJeztah/remove_lcow_step6
Remove LCOW (step 6)
2021-07-29 11:34:29 -07:00
Brian Goff
ad268e79c4
Merge pull request #42193 from lzhfromustc/3_23
discovery & test: Fix goroutine leaks by adding 1 buffer to channel
2021-07-28 15:25:37 -07:00
Sebastiaan van Stijn
0c84c322ae
daemon, oci: remove LCOW bits
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-27 13:35:59 +02:00
Roman Volosatovs
47ad2f3dd6
API,daemon: support type URL parameter to /system/df
Let clients choose object types to compute disk usage of.

Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-27 12:17:45 +02:00
Brian Goff
12f1b3ce43
Merge pull request #42616 from thaJeztah/migrate_pkg_signal
replace pkg/signal with moby/sys/signal v0.5.0
2021-07-26 10:47:28 -07:00
Brian Goff
9674540ccf
Merge pull request #42520 from thaJeztah/remove_lcow_step5_alternative
Remove LCOW (step 5): volumes/mounts: remove LCOW code (alternative)
2021-07-26 10:24:52 -07:00
yufeifly
17f39dcb4d fix a typo
Signed-off-by: yufeifly <yufei.xiong@qq.com>
2021-07-25 00:33:59 +08:00
Sebastiaan van Stijn
28409ca6c7
replace pkg/signal with moby/sys/signal v0.5.0
This code was moved to the moby/sys repository

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-23 09:32:54 +02:00
Sebastiaan van Stijn
d5dbbb5369
storage-driver: promote overlay2, make Btrfs and ZFS opt-in
The daemon uses a priority list to automatically select the best-matching storage
driver for the backing filesystem that is used.

Historically, overlay2 was not supported on Btrfs and ZFS, and the daemon would
automatically pick the `btrfs` or `zfs` storage driver if that was the Backing
File System.

Commits 649e4c8889 and e226aea280
improved our detection to check if overlay2 was supported on the backing file-
system, allowing overlay2 to be used on top of Btrfs or ZFS,  but did not change
the priority list.

While both Btrfs and ZFS have advantages for certain use-cases, and provide
advanced features that are not available to overlay2, they also are known
to require more "handholding", and are generally considered to be mostly
useful for "advanced" users.

This patch changes the storage-driver priority list, to prefer overlay2 (if
supported by the backing filesystem), and effectively makes btrfs and zfs
opt-in storage drivers.

This change does not affect existing installations; the daemon will detect
the storage driver that was previously in use (based on the presence of
storage directories in `/var/lib/docker`).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-21 14:53:56 +02:00
Brian Goff
9a6ff685a8
Merge pull request #42641 from thaJeztah/make_signal_selfcontained 2021-07-19 14:46:15 -07:00
Sebastiaan van Stijn
627bbd3fa4
Merge pull request #42132 from xia-wu/add-create-log-stream
Add an option to skip create log stream for awslogs driver
2021-07-19 16:42:36 +02:00
Justin Cormack
b337c70bdc
Merge pull request #42639 from thaJeztah/system_info_clean
pkg/sysinfo: assorted cleanup/refactoring for handling warnings and logging
2021-07-19 15:17:07 +01:00
Justin Cormack
ab974f6b57
Merge pull request #42620 from thaJeztah/daemon_stats_literal
daemon: use object literal for stats
2021-07-19 15:14:41 +01:00
Sebastiaan van Stijn
ea5c94cdb9
pkg/signal: move signal.DumpStacks() to a separate package
It is not directly related to signal-handling, so can well live
in its own package.

Also added a variant that doesn't take a directory to write files
to, for easier consumption / better match to how it's used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-15 18:09:43 +02:00
Sebastiaan van Stijn
9b795c3e50
pkg/sysinfo.New(), daemon.RawSysInfo(): remove "quiet" argument
The "quiet" argument was only used in a single place (at daemon startup), and
every other use had to pass "false" to prevent this function from logging
warnings.

Now that SysInfo contains the warnings that occurred when collecting the
system information, we can make leave it up to the caller to use those
warnings (and log them if wanted).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-14 23:10:07 +02:00
Roman Volosatovs
bf9c76f0a8
API, daemon/images: add ImageListOptions and pass context
This makes it easier to add more options to the backend without having to change
the signature.

While we're changing the signature, also adding a context.Context, which is not
currently used, but probably should be at some point.

Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
2021-07-13 13:45:24 +02:00
Sebastiaan van Stijn
115b37b8f7
daemon: use object literal for stats
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-11 14:16:13 +02:00
Sebastiaan van Stijn
0ff80c844d
daemon/config.New(): rewrite to be slightly more idiomatic
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-11 11:06:56 +02:00
Sebastiaan van Stijn
5588a78ab3
daemon/config: restrict "unix" code is linux
This code is not generically useful on "unix", and contains linux-
specific code, so make it only compile on linux.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-11 11:06:55 +02:00
Sebastiaan van Stijn
96f843ef30
daemon/config: move "common" tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-11 11:06:53 +02:00
Sebastiaan van Stijn
9d9679975f
daemon/config: remove CommonUnixConfig type
This type was added to support Solaris (which didn't support these
options). Solaris support was removed, so we can integrate this type
back into the "unix" type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-11 11:06:51 +02:00
Sebastiaan van Stijn
defeab7387
daemon/config: remove commonUnixBridgeConfig
This type was added to support Solaris (which didn't support these
options). Solaris support was removed, so we can integrate this type
back into the "unix" type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-11 11:06:49 +02:00
Sebastiaan van Stijn
a65f83317c
daemon/config: reorganize code between unix and windows files
Put variables and functions in the same owrder between both,
to allow for easier comparing between platforms.

Also synchronised some comments/godoc between both.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-11 11:06:42 +02:00
Sebastiaan van Stijn
ababae665d
Merge pull request #42550 from rvolosatovs/fix_image_shared_size
Fix SharedSize computation in `ImageService.Image` for filtered requests
2021-07-02 18:16:55 +02:00
Sebastiaan van Stijn
300c11c7c9
volume/mounts: remove "containerOS" argument from NewParser (LCOW code)
This changes mounts.NewParser() to create a parser for the current operatingsystem,
instead of one specific to a (possibly non-matching, in case of LCOW) OS.

With the OS-specific handling being removed, the "OS" parameter is also removed
from `daemon.verifyContainerSettings()`, and various other container-related
functions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-02 13:51:55 +02:00
Roman Volosatovs
af3e5568fc
daemon/images: fix shared size computation for filtered requests
Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
2021-07-02 11:46:25 +02:00
Adam Williams
a8d92be6e8 Use crypto/rand
Signed-off-by: Adam Williams <awilliams@mirantis.com>
2021-07-01 14:15:39 -07:00
Adam Williams
9f0e268b00 Fix use of unsafe ptr #42444
Signed-off-by: Adam Williams <awilliams@mirantis.com>
2021-07-01 12:24:33 -07:00
Roman Volosatovs
b308097ec3
daemon/images: refactor image listing
- Rename image summary constructor
    - Rename `newImage` into `newImageSummary`, since the returned type is
      `*types.ImageSummary`
- Rename variables for clarity
    - Rename `newImage` into `summary`, since the variable type is
      `*types.ImageSummary`
    - Rename `imagesMap` into `summaryMap`, since the value type
      contained is `*types.ImageSummary`
- Only compute `DiffSize` when more than 1 reference to the layer
  exists, since it is not used otherwise
- Move variable declarations closer to where they are used

Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-30 11:32:32 +02:00
Sebastiaan van Stijn
314759dc2f
Merge pull request #42393 from aiordache/daemon_config
Daemon config validation
2021-06-23 19:32:07 +02:00
Rich Horwood
8f80e55111 Add configuration validation option and tests.
Fixes #36911

If config file is invalid we'll exit anyhow, so this just prevents
the daemon from starting if the configuration is fine.

Mainly useful for making config changes and restarting the daemon
iff the config is valid.

Signed-off-by: Rich Horwood <rjhorwood@apple.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Anca Iordache <anca.iordache@docker.com>
2021-06-23 09:54:55 +00:00
Brian Goff
bf11970fd5
Merge pull request #42536 from thaJeztah/replace_deprecated_userns
replace uses of deprecated containerd/sys.RunningInUserNS()
2021-06-18 13:20:19 -07:00
Akihiro Suda
7729ebfa1b
Merge pull request #42432 from dperny/fix-ip-overlap 2021-06-19 01:07:27 +09:00
Sebastiaan van Stijn
472f21b923
replace uses of deprecated containerd/sys.RunningInUserNS()
This utility was moved to a separate package, which has no
dependencies.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-18 11:01:24 +02:00
Akihiro Suda
9e8cf1016e
Merge pull request #42473 from thaJeztah/unfork_buildkit
revendor BuildKit (master branch)
2021-06-17 10:56:25 +09:00
Sebastiaan van Stijn
2773f81aa5
Merge pull request #42445 from thaJeztah/bump_golang_ci
[testing] ~update~ fix linting issues found by golangci-lint v1.40.1
2021-06-16 22:15:01 +02:00
Sebastiaan van Stijn
3eb1257698
revendor BuildKit (master branch)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-16 01:17:48 +02:00
Tianon Gravi
a060328874
Merge pull request #42472 from thaJeztah/improve_rootless_option
daemon: improve handling of ROOTLESSKIT_PARENT_EUID
2021-06-11 13:03:31 -07:00
Justin Cormack
1ba54a5fd0
Merge pull request #42511 from thaJeztah/remove_lcow_step4
Remove LCOW (step 4): remove layerstore indexing by OS (used for LCOW)
2021-06-11 18:31:59 +01:00
Samuel Karp
17bf6211af
Merge pull request #42325 from thaJeztah/warn_on_non_matching_platform
docker pull: warn when pulled single-arch image does not match --platform
2021-06-10 16:53:50 -07:00
Sebastiaan van Stijn
dc7cbb9b33
remove layerstore indexing by OS (used for LCOW)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-10 17:49:11 +02:00
Sebastiaan van Stijn
e6dabfa977
graphdriver: temporarily ignore unsafeptr: possible misuse of reflect.SliceHeader
Probably needs a similar change as c208f03fbd,
but this code makes my head spin, so for now suppressing, and created a
tracking issue:

    daemon/graphdriver/graphtest/graphtest_unix.go:305:12: unsafeptr: possible misuse of reflect.SliceHeader (govet)
        header := *(*reflect.SliceHeader)(unsafe.Pointer(&buf))
                  ^
    daemon/graphdriver/graphtest/graphtest_unix.go:308:36: unsafeptr: possible misuse of reflect.SliceHeader (govet)
        data := *(*[]byte)(unsafe.Pointer(&header))
                                          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-10 13:03:47 +02:00