Commit graph

43441 commits

Author SHA1 Message Date
Tianon Gravi
12ba4848b2
Merge pull request #43230 from sheabot/bugfix/check-config-os-release
fix(check-config.sh): Check for existence of /etc/os-release before sourcing
2022-02-11 13:01:58 -08:00
Ryan Shea
2deec80dba fix(check-config.sh): Check for existence of /etc/os-release before sourcing
Signed-off-by: Ryan Shea <sheabot03@gmail.com>
2022-02-11 11:40:32 -07:00
Akihiro Suda
3b02526c1e
Merge pull request #42224 from thaJeztah/more_client_opts
client: extract FromEnv parts to separate WithXX options
2022-02-11 13:17:05 +09:00
Sebastiaan van Stijn
ea5b4765d9
Merge pull request #43195 from thaJeztah/update_golangci_lint
Dockerfile: update golangci-lint v1.44.0
2022-02-10 21:02:36 +01:00
Sebastiaan van Stijn
5c8d50a132
Merge pull request #43210 from tianon/frozen-names-generator
Freeze the namesgenerator package against new additions
2022-02-10 20:38:44 +01:00
Tianon Gravi
624b3cfbe8 Freeze the namesgenerator package against new additions
See the added comment/documentation within the package for more details.

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
2022-02-10 09:56:08 -08:00
Sebastiaan van Stijn
eae20b1a1b
client: extract FromEnv parts to separate WithXX options
Implements three options;

- WithTLSClientConfigFromEnv()
- WithHostFromEnv()
- WithVersionFromEnv()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-10 17:15:40 +01:00
Sebastiaan van Stijn
646ace6ee3
Dockerfile: update golangci-lint v1.44.0
Looks like this may be needed for Go 1.18

Also updating the golangci-lint configuration to account for updated
exclusion rules.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-08 09:43:30 +01:00
Sebastiaan van Stijn
89f63f476b
integration-cli: SA5011: possible nil pointer dereference (staticcheck)
I think the original intent here was to make passing t optional (62a856e912),
but it looks like that's not done anywhere, so let's remove it.

    integration-cli/docker_utils_test.go:81:2: SA5011: possible nil pointer dereference (staticcheck)
        c.Helper()
        ^
    integration-cli/docker_utils_test.go:84:5: SA5011(related information): this check suggests that the pointer can be nil (staticcheck)
        if c != nil {
           ^
    integration-cli/docker_utils_test.go:106:2: SA5011: possible nil pointer dereference (staticcheck)
        c.Helper()
        ^
    integration-cli/docker_utils_test.go:108:5: SA5011(related information): this check suggests that the pointer can be nil (staticcheck)
        if c != nil {
           ^
    integration-cli/docker_utils_test.go:116:2: SA5011: possible nil pointer dereference (staticcheck)
        c.Helper()
        ^
    integration-cli/docker_utils_test.go:118:5: SA5011(related information): this check suggests that the pointer can be nil (staticcheck)
        if c != nil {
           ^
    integration-cli/docker_utils_test.go:126:2: SA5011: possible nil pointer dereference (staticcheck)
        c.Helper()
        ^
    integration-cli/docker_utils_test.go:128:5: SA5011(related information): this check suggests that the pointer can be nil (staticcheck)
        if c != nil {
           ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-08 09:43:28 +01:00
Sebastiaan van Stijn
85ed9b8746
libnetwork: fix unhandled errors in tests (ineffassign)
libnetwork/libnetwork_test.go:1014:8: ineffectual assignment to err (ineffassign)
        sbx1, err := controller.NewSandbox(containerID,
              ^
    libnetwork/libnetwork_test.go:1024:8: ineffectual assignment to err (ineffassign)
        sbx2, err := controller.NewSandbox("c2")
              ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-08 09:43:27 +01:00
Sebastiaan van Stijn
99935ff803
client.NewClientWithOpts(): remove redundant type assertion (gosimple)
As caught by gosimple:

    client/client.go:138:14: S1040: type assertion to the same type: c.client.Transport already has type http.RoundTripper (gosimple)
        if _, ok := c.client.Transport.(http.RoundTripper); !ok {
                    ^

This check was originally added in dc9f5c2ca3, to
check if the passed option was a `http.Transport`, and later changed in
e345cd12f9 to check for `http.RoundTripper` instead.

Client.client is a http.Client, for which the Transport field is a RoundTripper,
so this check is redundant.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-08 09:43:25 +01:00
Sebastiaan van Stijn
b88f4e2604
daemon/logger/awslogs: suppress false positive on hardcoded creds (gosec)
daemon/logger/awslogs/cloudwatchlogs.go:42:2: G101: Potential hardcoded credentials (gosec)
        credentialsEndpointKey = "awslogs-credentials-endpoint"
        ^
    daemon/logger/awslogs/cloudwatchlogs.go:67:2: G101: Potential hardcoded credentials (gosec)
        credentialsEndpoint = "http://169.254.170.2"
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-08 09:43:22 +01:00
Sebastiaan van Stijn
a5c7575550
Merge pull request #43176 from thaJeztah/update_distribution
vendor: github.com/docker/distribution v2.8.0
2022-02-08 09:40:23 +01:00
Tianon Gravi
9bf647c375
Merge pull request #43202 from thaJeztah/skip_temporary_error_check
client/request.go:157:8: SA1019: err.Temporary is deprecated (staticcheck)
2022-02-07 16:42:05 -08:00
Sebastiaan van Stijn
be63b7d7f6
vendor: github.com/docker/distribution v2.8.0
full diff: http://github.com/docker/distribution/compare/0d3efadf0154...v2.8.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-07 18:34:47 +01:00
Justin Cormack
4b3471ddc0
Merge pull request #43200 from thaJeztah/fix_overlay_fuse_permissions
daemon/graphdriver/fuse-overlayfs: Init(): fix directory permissions (staticcheck)
2022-02-07 14:59:10 +00:00
Sebastiaan van Stijn
af4babd657
Merge pull request #43083 from AkihiroSuda/runc-1.1.0
update runc to v1.1.0
2022-02-06 11:40:31 +01:00
Akihiro Suda
b79dec8138
vendor: github.com/opencontainers/runc v1.1.0
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-02-06 17:16:23 +09:00
Akihiro Suda
0d04359ec2
vendor: golang.org/x/sys v0.0.0-20220114195835-da31bd327af9
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-02-06 16:28:59 +09:00
Akihiro Suda
c55eb6b824
update runc binary to v1.1.0
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-02-06 16:23:38 +09:00
Sebastiaan van Stijn
36313c4bdb
Merge pull request #43212 from thaJeztah/fix_vendor
hack/vendor.sh: run "go mod tidy" before vendoring
2022-02-05 19:55:40 +01:00
Sebastiaan van Stijn
325c3a457b
hack/vendor.sh: run "go mod tidy" before vendoring
The hack/vendor.sh script is used to (re)vendor dependencies. However, it did
not run `go mod tidy` before doing so, wheras the vendor _validation_ script
did.

This could result in vendor validation failing if go mod tidy resulted in
changes (which could be in `vendor.sum`).

In "usual" situations, this could be easily done by the user (`go mod tidy`
before running `go mod vendor`), but due to our (curent) uses of `vendor.mod`,
and having to first set up a (dummy) `go.mod`, this is more complicated.

Instead, just make the script do this, so that `hack/vendor.sh` will always
produce the expected result.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-05 11:25:23 +01:00
Tianon Gravi
f0e057f0e5
Merge pull request #43211 from thaJeztah/remove_names_generator_binary
pkg/namesgenerator: remove names-generator binary
2022-02-04 06:46:18 -08:00
Sebastiaan van Stijn
347a85787b
pkg/namesgenerator: remove names-generator binary
This binary was added in 0800650665, but no motivation,
other than "this could be nice". Searching if it's used by anyone, I found only
two occurrences, both of which were just examples, or indexing results;

- eae845e40e/tree-examples/docker.txt (L1229)
- 8b1e0b89c7/sync/cache/librariesioGoGo.json (L2200)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-04 10:37:19 +01:00
Tianon Gravi
21981800a2
Merge pull request #43189 from thaJeztah/remove_unused_win32k
pkg/system: remove unused HasWin32KSupport() and rewrite IsWindowsClient()
2022-02-03 12:03:18 -08:00
Sebastiaan van Stijn
2cff05e960
client/request.go:157:8: SA1019: err.Temporary is deprecated (staticcheck)
It's deprecated in Go 1.18:

    client/request.go:157:8: SA1019: err.Temporary is deprecated: Temporary errors are not well-defined. Most "temporary" errors are timeouts, and the few exceptions are surprising. Do not use this method. (staticcheck)
        if !err.Temporary() {
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-31 15:59:51 +01:00
Sebastiaan van Stijn
f9fb5d4f25
daemon/graphdriver/fuse-overlayfs: Init(): fix directory permissions (staticcheck)
daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:101:63: SA9002: file mode '700' evaluates to 01274; did you mean '0700'? (staticcheck)
        if err := idtools.MkdirAllAndChown(path.Join(home, linkDir), 700, currentID); err != nil {
                                                                     ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-28 12:50:30 +01:00
Sebastiaan van Stijn
ab9796b0e9
pkg/system: rewrite IsWindowsClient() using golang.org/x/sys/windows
Looks like we should be able to use the implementation from x/sys/windows.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-26 13:39:03 +01:00
Sebastiaan van Stijn
be463cbd6c
pkg/system: remove unused HasWin32KSupport()
This was added in 194eaa5c0f to check image
compatibility based on Platform.Features;

    // For now, hard code that all base images except nanoserver depend on win32k support
    if imageData.Name != "nanoserver" {
        imageData.OSFeatures = append(imageData.OSFeatures, "win32k")
    }

But no longer used since 1f59bc8c03 and
d231260868

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-26 13:11:58 +01:00
Sebastiaan van Stijn
3c06ebd876
Merge pull request #43168 from thaJeztah/skip_dockerpy_devices
docker-py: skip CreateContainerTest::test_create_with_device_cgroup_rules
2022-01-26 12:04:25 +01:00
Akihiro Suda
65b8bcc321
Merge pull request #43174 from thaJeztah/move_platformcheck
distribution: remove RootFSDownloadManager interface, and remove "os" argument from Download()
2022-01-26 14:08:44 +09:00
Sebastiaan van Stijn
559ff0ac66
Merge pull request #43103 from thaJeztah/image_import_platform
Add support for platform (os and architecture) on image import
2022-01-24 20:29:27 +01:00
Sebastiaan van Stijn
01ae9525dd
Add support for platform (os and architecture) on image import
Commit 0380fbff37 added the ability to pass a
--platform flag on `docker import` when importing an archive. The intent
of that commit was to allow importing a Linux rootfs on a Windows daemon
(as part of the experimental LCOW feature).

A later commit (337ba71fc1) changed some
of this code to take both OS and Architecture into account (for `docker build`
and `docker pull`), but did not yet update the `docker image import`.

This patch updates the import endpoitn to allow passing both OS and
Architecture. Note that currently only matching OSes are accepted,
and an error will be produced when (e.g.) specifying `linux` on Windows
and vice-versa.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-24 18:24:51 +01:00
Sebastiaan van Stijn
6b69de61f9
integration-cli: TestImportBadURL: use proper rfc6761 "invalid domain"
Just a minor nit: make sure we use a designated "bad" domain
https://datatracker.ietf.org/doc/html/rfc6761#section-6.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-24 17:00:57 +01:00
Sebastiaan van Stijn
9839ddd800
api: postImagesCreate(): use local variable for platform
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-24 17:00:55 +01:00
Sebastiaan van Stijn
81ac487d71
api: postImagesCreate(): rename ambiguous err variable
This error is meant to be used in the output stream, and some comments
were added to prevent accidentally using local variables.

Renaming the variable instead to make it less ambiguous.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-24 17:00:53 +01:00
Sebastiaan van Stijn
bb66ebd621
distribution: xfer.LayerDownloadManager.Download(): remove "os" argument
This argument was added for LCOW support, but it was only used to verify if
the passed platform (OS) matched the host. Given that all uses of this function
(except for one) passed runtime.GOOS, we may as well move the check to that
location.

We should do more cleaning up after this, and perform such validations early,
instead of passing platform around in too many places where it's only used for
similar validations. This is a first step in that direction.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-21 15:07:55 +01:00
Sebastiaan van Stijn
eddbd6ff1e
Merge pull request #43132 from lzhfromustc/patch_1_7
test: fix a simple goroutine leak in distribution/xfer
2022-01-21 14:10:47 +01:00
Sebastiaan van Stijn
0b0a995d9d
distribution: remove RootFSDownloadManager interface
This interface only had a single implementation (xfer.LayerDownloadManager),
and all places where it was used already imported the xfer package.
Removing the interface, also makes it a closer match to the "upload" part,
as `xfer.LayerUploadManager()` did not use an interface.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-21 13:53:36 +01:00
Akihiro Suda
84cac21e38
Merge pull request #43172 from thaJeztah/lxc_my_old_friend
api: remove HostConfig.LxcConf field from swagger and docs
2022-01-21 18:00:10 +09:00
Aaron Lehmann
40bb983175
Merge pull request #43095 from aaronlehmann/avoid-regexp-simple-cases
fileutils: Avoid compiling a regexp for simple patterns
2022-01-20 17:43:07 -08:00
Aaron Lehmann
38e2e756c9 Avoid platform-specific NewPatternMatcher function in TestCompile
Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
2022-01-20 09:08:16 -08:00
Sebastiaan van Stijn
839e2ecc1b
docs: remove HostConfig.LxcConf field from API docs
Commit 3b5fac462d  / docker 1.10 removed support
for the LXC runtime, and removed the corresponding fields from the API (v1.22).

This patch removes the `HostConfig.LxcConf` field from the API documentation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-20 17:24:07 +01:00
Sebastiaan van Stijn
75a1ad0c9f
api: remove HostConfig.LxcConf field
Commit 3b5fac462d  / docker 1.10 removed support
for the LXC runtime, and removed the corresponding fields from the API (v1.22).

This patch removes the `HostConfig.LxcConf` field from the swagger definition.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-20 17:23:51 +01:00
Sebastiaan van Stijn
6e05fa7076
Merge pull request #43161 from Haarolean/master
Fixed broken links in project documentation files.
2022-01-20 13:06:48 +01:00
Sebastiaan van Stijn
037b4c0e8e
docker-py: skip CreateContainerTest::test_create_with_device_cgroup_rules
This test is verifying that the container has the right options set (through
`docker inspect`), but also checks if the cgroup-rules are set within the container
by reading `/sys/fs/cgroup/devices/devices`

Unlike cgroups v1, on cgroups v2, there is no file interface, and rules are handled
through ebpf, which means that the test will fail because this file is not present.

From the Linux documentation for cgroups v2: https://github.com/torvalds/linux/blob/v5.16/Documentation/admin-guide/cgroup-v2.rst#device-controller

> (...)
> Device controller manages access to device files. It includes both creation of
> new device files (using mknod), and access to the existing device files.
>
> Cgroup v2 device controller has no interface files and is implemented on top of
> cgroup BPF. To control access to device files, a user may create bpf programs
> of type BPF_PROG_TYPE_CGROUP_DEVICE and att>

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-20 11:11:22 +01:00
Sebastiaan van Stijn
860db4f4e3
Merge pull request #43101 from thaJeztah/go_mod_rebase
vendor: use go mod (rebase after removal of deprecated host-discovery)
2022-01-20 09:21:49 +01:00
Sebastiaan van Stijn
b47c0b8896
Merge pull request #43152 from thaJeztah/bump_go_1.17.6
Update Go to 1.17.6
2022-01-18 17:37:39 +01:00
Sebastiaan van Stijn
ace8c7896c
vendor: cloud.google.com/go v0.59.0 to remove some test-deps
commit ad4f9324cd
removes some of the test-dependencies from cloud.google.com.

only other relevant changes in vendored code are from this commit:
dccc6b4b71

Full diff: https://github.com/googleapis/google-cloud-go/compare/v0.44.3...v0.59.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-18 15:46:08 +01:00
Sebastiaan van Stijn
3bd74488fd
Makefile: use volume for go mod cache when running dev-container
This allows the modules to be cached when vendoring modules from within
the dev container.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-18 15:46:06 +01:00