Commit graph

39399 commits

Author SHA1 Message Date
Sebastiaan van Stijn
97a5b797b6
Use designated test domains (RFC2606) in tests
Some tests were using domain names that were intended to be "fake", but are
actually registered domain names (such as domain.com, registry.com, mytest.com).

Even though we were not actually making connections to these domains, it's
better to use domains that are designated for testing/examples in RFC2606:
https://tools.ietf.org/html/rfc2606

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-04-02 14:06:27 +02:00
Brian Goff
1ff685085a
Merge pull request #42173 from thaJeztah/unused_errors 2021-04-01 11:47:19 -07:00
Tibor Vass
5b11047c25
Merge pull request #42188 from AkihiroSuda/fix-overlay2-naivediff
rootless: overlay2: fix "createDirWithOverlayOpaque(...) ... input/output error"
2021-04-01 05:03:24 -07:00
Tibor Vass
e19ca14146
Merge pull request #42189 from AkihiroSuda/specconv-fix-trimspace
rootless: fix getCurrentOOMScoreAdj (fix rootless docker in kubernetes)
2021-04-01 03:10:18 -07:00
Sebastiaan van Stijn
948d8e94cb
Merge pull request #42230 from AkihiroSuda/fix-rootless-bind-EPERM
rootless: bind mount: fix "operation not permitted"
2021-04-01 11:43:18 +02:00
Tibor Vass
f08129a613
Merge pull request #42219 from AkihiroSuda/rootlesskit-0.14.1
bump up rootlesskit to v0.14.1 (Fix `DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns` regression)
2021-04-01 02:35:25 -07:00
Akihiro Suda
248f98ef5e
rootless: bind mount: fix "operation not permitted"
The following was failing previously, because `getUnprivilegedMountFlags()` was not called:
```console
$ sudo mount -t tmpfs -o noexec none /tmp/foo
$ $ docker --context=rootless run -it --rm -v /tmp/foo:/mnt:ro alpine
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:520: container init caused: rootfs_linux.go:60: mounting "/tmp/foo" to rootfs at "/home/suda/.local/share/docker/overlay2/b8e7ea02f6ef51247f7f10c7fb26edbfb308d2af8a2c77915260408ed3b0a8ec/merged/mnt" caused: operation not permitted: unknown.
```

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-04-01 14:58:11 +09:00
Sebastiaan van Stijn
b96a0909f0
Merge pull request #42223 from StefanScherer/arm64-ubuntu
Pin arm64 machines to a specific Ubuntu version
2021-03-30 21:08:44 +02:00
Stefan Scherer
b7c3548c82
Pin arm64 machines to a specific Ubuntu version
Signed-off-by: Stefan Scherer <stefan.scherer@docker.com>
2021-03-30 17:03:32 +02:00
Akihiro Suda
45021ee354
bump up rootlesskit to v0.14.1
Fix `DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns` regression.

Full changes: https://github.com/rootless-containers/rootlesskit/compare/v0.14.0...v0.14.1

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-03-30 18:01:44 +09:00
Tibor Vass
d7a5abe6bd
Merge pull request #41908 from thaJeztah/bump_libnetwork
vendor: docker/libnetwork b3507428be5b458cb0e2b4086b13531fb0706e46
2021-03-29 09:43:37 -07:00
Akihiro Suda
6322dfc217
archive: do not use overlayWhiteoutConverter for UserNS
overlay2 no longer sets `archive.OverlayWhiteoutFormat` when
running in UserNS, so we can remove the complicated logic in the
archive package.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-03-29 14:47:12 +09:00
Akihiro Suda
67aa418df2
overlay2: doesSupportNativeDiff: add fast path for userns
When running in userns, returns error (i.e. "use naive, not native")
immediately.

No substantial change to the logic.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-03-29 14:47:09 +09:00
Akihiro Suda
dd97134232
overlay2: call d.naiveDiff.ApplyDiff when useNaiveDiff==true
Previously, `d.naiveDiff.ApplyDiff` was not used even when
`useNaiveDiff()==true`

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-03-26 14:34:56 +09:00
Sebastiaan van Stijn
0450728267
vendor: docker/libnetwork b3507428be5b458cb0e2b4086b13531fb0706e46
full diff: fa125a3512...b3507428be

- fixed IPv6 iptables rules for enabled firewalld (libnetwork#2609)
    - fixes "Docker uses 'iptables' instead of 'ip6tables' for IPv6 NAT rule, crashes"
- Fix regression in docker-proxy
    - introduced in "Fix IPv6 Port Forwarding for the Bridge Driver" (libnetwork#2604)
    - fixes/addresses: "IPv4 and IPv6 addresses are not bound by default anymore" (libnetwork#2607)
    - fixes/addresses "IPv6 is no longer proxied by default anymore" (moby#41858)
- Use hostIP to decide on Portmapper version
    - fixes docker-proxy not being stopped correctly

Port mapping of containers now contain separatet mappings for IPv4 and IPv6 addresses, when
listening on "any" IP address. Various tests had to be updated to take multiple mappings into
account.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-25 00:19:35 +01:00
Sebastiaan van Stijn
c8599a6537
fix assertPortList normalizing being too strict
The normalizing was updated with the output of the "docker port" command
in mind, but we're normalizing the "expected" output, which is passed
without the "->" in front of the mapping, causing some tests to fail;

    === RUN   TestDockerSuite/TestPortHostBinding
        --- FAIL: TestDockerSuite/TestPortHostBinding (1.21s)
            docker_cli_port_test.go:324: assertion failed: error is not nil: |:::9876!=[::]:9876|
    === RUN   TestDockerSuite/TestPortList
        --- FAIL: TestDockerSuite/TestPortList (0.96s)
            docker_cli_port_test.go:25: assertion failed: error is not nil: |:::9876!=[::]:9876|

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-25 00:19:01 +01:00
Tibor Vass
797b974cb9
Merge pull request #41912 from thaJeztah/improve_build_errors
builder: produce error when using unsupported Dockerfile option
2021-03-24 14:30:45 -07:00
Tibor Vass
08e67904c9
Merge pull request #42050 from thaJeztah/ci_fixes
CI: update tests to be more resilient against CLI output format and for libnetwork changes
2021-03-24 13:19:26 -07:00
Akihiro Suda
dea989ea2f
Merge pull request #42192 from tiborvass/rootlesskit_goproxy
hack: use GOPROXY for rootlesskit to workaround issue with old git on…
2021-03-24 14:50:00 +09:00
Akihiro Suda
d6ddfb6118
rootless: fix getCurrentOOMScoreAdj
`getCurrentOOMScoreAdj()` was broken because `strconv.Atoi()` was called
without trimming "\n".

Fix issue 40068: `rootless docker in kubernetes: "getting the final child's pid from
pipe caused \"EOF\": unknown"

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-03-24 14:42:12 +09:00
Brian Goff
7b9275c0da
Merge pull request #42116 from xrisfg/patch-1
Correct name (right) sort order
2021-03-23 16:59:01 -07:00
Tibor Vass
cbc6cefdcb hack: use GOPROXY for rootlesskit to workaround issue with old git on CentOS/RHEL 7
Since rootlesskit removed vendor folder, building it has to rely on go mod.

Dockerfile in docker-ce-packaging uses GOPROXY=direct, which makes "go mod"
commands use git to fetch modules. "go mod" in Go versions before 1.14.1 are
incompatible with older git versions, including the version of git that ships
with CentOS/RHEL 7 (which have git 1.8), see golang/go#38373

This patch switches rootlesskit install script to set GOPROXY to
https://proxy.golang.org so that git is not required for downloading modules.

Once all our code has upgraded to Go 1.14+, this workaround should be
removed.

Signed-off-by: Tibor Vass <tibor@docker.com>
2021-03-23 21:21:26 +00:00
Tianon Gravi
545d02e037
Merge pull request #42187 from KentaTada/fix-seccomp-kernel-config
check-config.sh: add SECCOMP_FILTER
2021-03-23 11:50:00 -07:00
Kenta Tada
1c72a68f2a check-config.sh: add SECCOMP_FILTER
The check of seccomp filter support was needed.

Ref: https://github.com/opencontainers/runc/pull/2867

Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2021-03-23 11:16:25 +09:00
Tibor Vass
db2759dbf7
Merge pull request #42179 from thaJeztah/update_rootlesskit
update rootlesskit to v0.14.0
2021-03-22 09:42:58 -07:00
Sebastiaan van Stijn
c6038b4884
integration-cli: rely less on "docker port" output format
Also re-formatting some lines for readability.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-22 12:00:31 +01:00
Sebastiaan van Stijn
f845b98ca6
integration: update getExternalAddress to prefer IPv4
Rootlesskit doesn't currently handle IPv6 addresses, causing TestNetworkLoopbackNat
and TestNetworkNat to fail;

    Error starting userland proxy:
    error while calling PortManager.AddPort(): listen tcp: address :::8080: too many colons in address

This patch:

- Updates `getExternalAddress()` to pick IPv4 address if both IPv6 and IPv4 are found
- Update TestNetworkNat to net.JoinHostPort(), so that square brackets are used for
  IPv6 addresses (e.g. `[::]:8080`)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-22 11:51:07 +01:00
Sebastiaan van Stijn
54ca929a70
integration/container: wrap some long lines for readability
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-22 11:08:07 +01:00
Sebastiaan van Stijn
e166af959d
update rootlesskit to v0.14.0
full diff: https://github.com/rootless-containers/rootlesskit/compare/v0.13.1...v0.14.0

v0.14.0 Changes (since v0.13.2)
--------------------------------------

- CLI: improve --help output
- API: support GET /info
- Port API: support specifying IP version explicitly ("tcp4", "tcp6")
- rootlesskit-docker-proxy: support libnetwork >= 20201216 convention
- Allow vendoring with moby/sys/mountinfo@v0.1.3 as well as @v0.4.0
- Remove socat port driver
    - socat driver has been deprecated since v0.7.1 (Dec 2019)
- New experimental flag: --ipv6
    - Enables IPv6 routing (slirp4netns --enable-ipv6). Unrelated to port driver.

v0.13.2
--------------------------------------

- Fix cleaning up crashed state dir
- Update Go to 1.16
- Misc fixes

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-22 11:00:54 +01:00
Akihiro Suda
dc4a600a78
Merge pull request #42167 from cpuguy83/testPushMultipleTags 2021-03-21 01:12:20 +09:00
Sebastiaan van Stijn
0f32beb4f8
libcontainerd: remove unused consts
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-19 21:52:23 +01:00
Sebastiaan van Stijn
9637be0e9d
libcontainerd: remove unused win32 errors (leftover from TP4)
These were added in 94d70d8355 for Windows TP4,
but no longer used after 331c8a86d4 removed
support for TP4.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-19 21:52:21 +01:00
Brian Goff
788f2883d2
Merge pull request #42104 from cpuguy83/41820_fix_json_unexpected_eof 2021-03-18 14:18:11 -07:00
Brian Goff
601707a655 TestPushMultipleTags: Add support for 20.10 CLI
In 20.10 we no longer implicitly push all tags and require a
"--all-tags" flag, so add this to the test when the CLI is >= 20.10

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-03-18 19:26:17 +00:00
Brian Goff
a84d824c5f
Merge pull request #42068 from AkihiroSuda/ovl-k511 2021-03-18 11:54:01 -07:00
Brian Goff
5a664dc87d jsonfile: more defensive reader implementation
Tonis mentioned that we can run into issues if there is more error
handling added here. This adds a custom reader implementation which is
like io.MultiReader except it does not cache EOF's.
What got us into trouble in the first place is `io.MultiReader` will
always return EOF once it has received an EOF, however the error
handling that we are going for is to recover from an EOF because the
underlying file is a file which can have more data added to it after
EOF.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-03-18 18:44:46 +00:00
Sebastiaan van Stijn
e0c87f90cd
Merge pull request #42163 from cpuguy83/TestDockerNetworkFlagAlias
Remove cli test for duplicate --net/--network opts
2021-03-18 19:39:45 +01:00
Brian Goff
ece4cd4c4d
Merge pull request #41757 from thaJeztah/carry_39371_remove_more_v1_code 2021-03-18 11:38:07 -07:00
Brian Goff
e31086320e Remove cli test for duplicate --net/--network opts
This seems to be testing a strange case, specifically that one can set
the `--net` and `--network` in the same command with the same network.

Indeed this used to work with older CLIs but newer ones error out when
validating the request before sending it to the daemon.

Opening this for discussion because:

1. This doesn't seem to be testing anything at all related to the rest
   of the test
2. Not really providing any value here.
3. Is testing that a technically invalid option is successful (whether
   the option should be valid as it relates to the CLI accepting it is
   debatable).
4. Such a case seems fringe and even a bug in whatever is calling the
   CLI with such options.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-03-18 17:15:02 +00:00
Tianon Gravi
737b400e0b
Merge pull request #42145 from thaJeztah/bump_cobra
vendor: github.com/spf13/cobra v1.1.3
2021-03-17 18:21:42 -07:00
Akihiro Suda
4735a0c84f
Merge pull request #42054 from jhuntwork/41704-update-libseccomp 2021-03-15 05:54:43 +09:00
Sebastiaan van Stijn
fb886a119b
vendor: github.com/spf13/cobra v1.1.3
full diff: https://github.com/spf13/cobra/compare/v1.1.1...v1.1.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-14 18:59:06 +01:00
Sebastiaan van Stijn
a09c0276a2
builder: produce error when using unsupported Dockerfile option
With the promotion of the experimental Dockerfile syntax to "stable", the Dockerfile
syntax now includes some options that are supported by BuildKit, but not (yet)
supported in the classic builder.

As a result, parsing a Dockerfile may succeed, but any flag that's known to BuildKit,
but not supported by the classic builder is silently ignored;

    $ mkdir buildkit_flags && cd buildkit_flags
    $ touch foo.txt

For example, `RUN --mount`:

    DOCKER_BUILDKIT=0 docker build --no-cache -f- . <<EOF
    FROM busybox
    RUN --mount=type=cache,target=/foo echo hello
    EOF

    Sending build context to Docker daemon  2.095kB
    Step 1/2 : FROM busybox
     ---> 219ee5171f80
    Step 2/2 : RUN --mount=type=cache,target=/foo echo hello
     ---> Running in 022fdb856bc8
    hello
    Removing intermediate container 022fdb856bc8
     ---> e9f0988844d1
    Successfully built e9f0988844d1

Or `COPY --chmod` (same for `ADD --chmod`):

    DOCKER_BUILDKIT=0 docker build --no-cache -f- . <<EOF
    FROM busybox
    COPY --chmod=0777 /foo.txt /foo.txt
    EOF

    Sending build context to Docker daemon  2.095kB
    Step 1/2 : FROM busybox
     ---> 219ee5171f80
    Step 2/2 : COPY --chmod=0777 /foo.txt /foo.txt
     ---> 8b7117932a2a
    Successfully built 8b7117932a2a

Note that unknown flags still produce and error, for example, the below fails because `--hello` is an unknown flag;

    DOCKER_BUILDKIT=0 docker build -<<EOF
    FROM busybox
    RUN --hello echo hello
    EOF

    Sending build context to Docker daemon  2.048kB
    Error response from daemon: dockerfile parse error line 2: Unknown flag: hello

With this patch applied
----------------------------

With this patch applied, flags that are known in the Dockerfile spec, but are not
supported by the classic builder, produce an error, which includes a link to the
documentation how to enable BuildKit:

    DOCKER_BUILDKIT=0 docker build --no-cache -f- . <<EOF
    FROM busybox
    RUN --mount=type=cache,target=/foo echo hello
    EOF

    Sending build context to Docker daemon  2.048kB
    Step 1/2 : FROM busybox
     ---> b97242f89c8a
    Step 2/2 : RUN --mount=type=cache,target=/foo echo hello
    the --mount option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled

    DOCKER_BUILDKIT=0 docker build --no-cache -f- . <<EOF
    FROM busybox
    COPY --chmod=0777 /foo.txt /foo.txt
    EOF

    Sending build context to Docker daemon  2.095kB
    Step 1/2 : FROM busybox
     ---> b97242f89c8a
    Step 2/2 : COPY --chmod=0777 /foo.txt /foo.txt
    the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-03-14 14:11:08 +01:00
Brian Goff
4f36654057
Merge pull request #41506 from thaJeztah/bump_coreos_pkg
vendor: github.com/coreos/pkg v4
2021-03-12 12:52:55 -08:00
Sebastiaan van Stijn
4648e8bc6f
Merge pull request #42067 from AkihiroSuda/vpnkit-arm64
Include VPNkit binary for arm64
2021-03-12 09:02:28 +01:00
Brian Goff
4be98a38e7 Fix handling for json-file io.UnexpectedEOF
When the multireader hits EOF, we will always get EOF from it, so we
cannot store the multrireader fro later error handling, only for the
decoder.

Thanks @tobiasstadler for pointing this error out.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-03-11 20:01:03 +00:00
Akihiro Suda
a8008f7313
overlayutils/userxattr.go: add "fast path" for kernel >= 5.11.0
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-03-11 15:18:59 +09:00
Akihiro Suda
11ef8d3ba9
overlay2: support "userxattr" option (kernel 5.11)
The "userxattr" option is needed for mounting overlayfs inside a user namespace with kernel >= 5.11.

The "userxattr" option is NOT needed for the initial user namespace (aka "the host").

Also, Ubuntu (since circa 2015) and Debian (since 10) with kernel < 5.11 can mount the overlayfs in a user namespace without the "userxattr" option.

The corresponding kernel commit: 2d2f2d7322ff43e0fe92bf8cccdc0b09449bf2e1
> **ovl: user xattr**
>
> Optionally allow using "user.overlay." namespace instead of "trusted.overlay."
> ...
> Disable redirect_dir and metacopy options, because these would allow privilege escalation through direct manipulation of the
> "user.overlay.redirect" or "user.overlay.metacopy" xattrs.

Fix issue 42055

Related to containerd/containerd PR 5076

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-03-11 15:12:41 +09:00
Jeremy Huntwork
1600e851b5 Use buster backports to build with libseccomp-2.4.4
Fixes #41704

The latest released versions of the static binaries (20.10.3) are still unable
to use faccessat2 with musl-1.2.2 even though this was addressed in #41353 and
related issues. The underlying cause seems to be that the build system
here still uses the default version of libseccomp shipped with buster.
An updated version is available in buster backports:
https://packages.debian.org/buster-backports/libseccomp-dev

Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com>
2021-03-10 10:01:28 -05:00
Chris Kreussling (Flatbush Gardener)
7024564c48 Correct name (right) sort order
Move "montalcini" to between "mirzakhani" and "moore"

Signed-off-by: Chris Kreussling (Flatbush Gardener) <xrisfg@gmail.com>
2021-03-09 08:22:14 -05:00