Commit Graph

109 Commits

Author SHA1 Message Date
Paweł Gronowski
b9319f64ed client: Change ImageSave to use functional options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-14 14:25:39 +01:00
Paweł Gronowski
ae4c688fd8 client: Change ImageLoad to use functional options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-14 14:25:37 +01:00
Paweł Gronowski
85808a6abf client: Change ImageHistory to use functional options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-14 13:55:30 +01:00
Paweł Gronowski
a096045678 all: Replace deprecated ImageInspectWithRaw usage
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-06 13:31:48 +01:00
Sebastiaan van Stijn
53a9127349 integration/build: make TestBuildEmitsImageCreateEvent less noisy
This test by default was outputing the build-progress output, and printing
a log for every event received, which made the test output rather noisy;

    === RUN   TestBuildEmitsImageCreateEvent
    === RUN   TestBuildEmitsImageCreateEvent/v1
        build_test.go:765: {"stream":"Step 1/2 : FROM busybox"}

            {"stream":"\n"}

            {"stream":" ---\u003e 19d689bc58fd\n"}

            {"stream":"Step 2/2 : RUN echo hello \u003e /hello"}

            {"stream":"\n"}

            {"stream":" ---\u003e Running in 538c10d10d69\n"}

            {"stream":" ---\u003e ca6d3b3e2dea\n"}

            {"aux":{"ID":"sha256:ca6d3b3e2dea645eeddd838da65fd06986da1392b6091dd3d3b89f239dc44f57"}}

            {"stream":"Successfully built ca6d3b3e2dea\n"}

        build_test.go:776: Got event type: container action: create
        build_test.go:776: Got event type: container action: attach
        build_test.go:776: Got event type: network action: connect
        build_test.go:776: Got event type: container action: start
        build_test.go:776: Got event type: network action: disconnect
        build_test.go:776: Got event type: container action: die
        build_test.go:776: Got event type: image action: create
    === RUN   TestBuildEmitsImageCreateEvent/v2
        build_test.go:765: {"id":"moby.buildkit.trace","aux":"Cm8KR3NoYTI1NjowZWViNmZmNTg0ZDJhODEwODhjMTJlNmVkODMxZDcyNWVhMjZmNTg2NjcyNDQ0MzU3NTNkNmZiOGVhMDBiNGFiGiRbaW50ZXJuYWxdIGxvYWQgcmVtb3RlIGJ1aWxkIGNvbnRleHQ="}

            {"id":"moby.buildkit.trace","aux":"CnwKR3NoYTI1NjowZWViNmZmNTg0ZDJhODEwODhjMTJlNmVkODMxZDcyNWVhMjZmNTg2NjcyNDQ0MzU3NTNkNmZiOGVhMDBiNGFiGiRbaW50ZXJuYWxdIGxvYWQgcmVtb3RlIGJ1aWxkIGNvbnRleHQqCwj+tIC7BhCxkpNl"}

            {"id":"moby.buildkit.trace","aux":"CokBCkdzaGEyNTY6MGVlYjZmZjU4NGQyYTgxMDg4YzEyZTZlZDgzMWQ3MjVlYTI2ZjU4NjY3MjQ0NDM1NzUzZDZmYjhlYTAwYjRhYhokW2ludGVybmFsXSBsb2FkIHJlbW90ZSBidWlsZCBjb250ZXh0KgsI/rSAuwYQsZKTZTILCP60gLsGELmTrHg="}

            {"id":"moby.buildkit.trace","aux":"CokBCkdzaGEyNTY6MGVlYjZmZjU4NGQyYTgxMDg4YzEyZTZlZDgzMWQ3MjVlYTI2ZjU4NjY3MjQ0NDM1NzUzZDZmYjhlYTAwYjRhYhokW2ludGVybmFsXSBsb2FkIHJlbW90ZSBidWlsZCBjb250ZXh0KgsI/rSAuwYQpZC3eDILCP60gLsGELbLuXg="}

            {"id":"moby.buildkit.trace","aux":"CqMBCkdzaGEyNTY6MzFjMGEyZDk1N2Q2MTQ2ZjE0NDEyNTM4YTc2YTAxNjhlOWQ5NzY2ZjA0ZjNmMDM4OGQ1YzdjNjQ1ODQ0NDQ3YxJHc2hhMjU2OjBlZWI2ZmY1ODRkMmE4MTA4OGMxMmU2ZWQ4MzFkNzI1ZWEyNmY1ODY2NzI0NDQzNTc1M2Q2ZmI4ZWEwMGI0YWIaD2NvcHkgL2NvbnRleHQgLw=="}

            {"id":"moby.buildkit.trace","aux":"CrABCkdzaGEyNTY6MzFjMGEyZDk1N2Q2MTQ2ZjE0NDEyNTM4YT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mYxZjUyMGVlMzllNzA3YTcyNGNhNjRiN2VhM2IyMGYwOTc2ZDJmN2NiNDBkY2Q5MWU2NTk1YRJHc2hhMjU2OjIyNzAwYzkxMGNmY2I3MjNjZGYyZmNjMGYxNzQ1MjAzMDQxNzk1NmY0ZDhiZjEzZjZkZmRkZWM3NjgxZDcxODAaHVsyLzJdIFJVTiBlY2hvIGhlbGxvID4gL2hlbGxvCnYKR3NoYTI1NjoyMjcwMGM5MTBjZmNiNzIzY2RmMmZjYzBmMTc0NTIwMzA0MTc5NTZmNGQ4YmYxM2Y2ZGZkZGVjNzY4MWQ3MTgwGitbMS8yXSBGUk9NIGRvY2tlci5pby9saWJyYXJ5L2J1c3lib3g6bGF0ZXN0"}

            {"id":"moby.buildkit.trace","aux":"CoQBCkdzaGEyNTY6MjI3MDBjOTEwY2ZjYjcyM2NkZjJmY2MwZjE3NDUyMDMwNDE3OTU2ZjRkOGJmMTNmNmRmZGRlYzc2ODFkNzE4MBorWzEvMl0gRlJPTSBkb2NrZXIuaW8vbGlicmFyeS9idXN5Ym94OmxhdGVzdCoMCP60gLsGEKKYuYkB"}

            {"id":"moby.buildkit.trace","aux":"CpIBCkdzaGEyNTY6MjI3MDBjOTEwY2ZjYjcyM2NkZjJmY2MwZjE3NDUyMDMwNDE3OTU2ZjRkOGJmMTNmNmRmZGRlYzc2ODFkNzE4MBorWzEvMl0gRlJPTSBkb2NrZXIuaW8vbGlicmFyeS9idXN5Ym94OmxhdGVzdCoMCP60gLsGEKKYuYkBMgwI/rSAuwYQhurIiQE="}

            {"id":"moby.buildkit.trace","aux":"CoQBCkdzaGEyNTY6MjI3MDBjOTEwY2ZjYjcyM2NkZjJmY2MwZjE3NDUyMDMwNDE3OTU2ZjRkOGJmMTNmNmRmZGRlYzc2ODFkNzE4MBorWzEvMl0gRlJPTSBkb2NrZXIuaW8vbGlicmFyeS9idXN5Ym94OmxhdGVzdCoMCP60gLsGEPGI0YkB"}

            {"id":"moby.buildkit.trace","aux":"CpI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kZjI4YTI1OGMxMTUwNjg3MTFhNGZhYmMzNTIzZDhiYWQyMTk4MjA3NzIxYzIMCP60gLsGEIe6s+4BOgwI/rSAuwYQq7az7gE="}

            {"id":"moby.buildkit.trace","aux":"EoUBChBleHBvcnRpbmcgbGF5ZXJzEkdzaGEyNTY6ZjFjOWQyMzUzYTlkZWY4MDkyNjhkZjI4YTI1OGMxMTUwNjg3MTFhNGZhYmMzNTIzZDhiYWQyMTk4MjA3NzIxYzIMCP60gLsGEOz5ovsBOgwI/rSAuwYQq7az7gFCDAj+tIC7BhDV8qL7AQ=="}

            {"id":"moby.buildkit.trace","aux":"ErwBClV3cml0aW5nIGltYWdlIHNoYTI1Njo5YjIzODY3ODkzZGMyZDVlM2UxNDBhYjBlY2Y1ZGI4MzlhYjA0YzQ0NjRiNjMyZTQ5ZTg3YzBmOThkZDEyYzFhEkdzaGEyNTY6ZjFjOWQyMzUzYTlkZWY4MDkyNjhkZjI4YTI1OGMxMTUwNjg3MTFhNGZhYmMzNTIzZDhiYWQyMTk4MjA3NzIxYzIMCP60gLsGEPHIq/sBOgwI/rSAuwYQ38Wr+wE="}

            {"id":"moby.buildkit.trace","aux":"EsoBClV3cml0aW5nIGltYWdlIHNoYTI1Njo5YjIzODY3ODkzZGMyZDVlM2UxNDBhYjBlY2Y1ZGI4MzlhYjA0YzQ0NjRiNjMyZTQ5ZTg3YzBmOThkZDEyYzFhEkdzaGEyNTY6ZjFjOWQyMzUzYTlkZWY4MDkyNjhkZjI4YTI1OGMxMTUwNjg3MTFhNGZhYmMzNTIzZDhiYWQyMTk4MjA3NzIxYzIMCP60gLsGEOuB7vwBOgwI/rSAuwYQ38Wr+wFCDAj+tIC7BhCT/+38AQ=="}

            {"id":"moby.buildkit.trace","aux":"CnkKR3NoYTI1NjpmMWM5ZDIzNTNhOWRlZjgwOTI2OGRmMjhhMjU4YzExNTA2ODcxMWE0ZmFiYzM1MjNkOGJhZDIxOTgyMDc3MjFjGhJleHBvcnRpbmcgdG8gaW1hZ2UqDAj+tIC7BhC6trLuATIMCP60gLsGEJG6x4QC"}

            {"id":"moby.image.id","aux":{"ID":"sha256:9b23867893dc2d5e3e140ab0ecf5db839ab04c4464b632e49e87c0f98dd12c1a"}}

        build_test.go:776: Got event type: image action: create

This patch preserves both, but only prints them if the test failed to
help debugging failures.

With this patch:

On success:

    === RUN   TestBuildEmitsImageCreateEvent
    === RUN   TestBuildEmitsImageCreateEvent/v1
    === RUN   TestBuildEmitsImageCreateEvent/v2
    --- PASS: TestBuildEmitsImageCreateEvent (1.53s)
        --- PASS: TestBuildEmitsImageCreateEvent/v1 (0.48s)
        --- PASS: TestBuildEmitsImageCreateEvent/v2 (1.03s)
    PASS

When failing:

    === Failed
    === FAIL: arm64.integration.build TestBuildEmitsImageCreateEvent/v1 (0.97s)
        build_test.go:789: assertion failed: 1 (int) != 0 (imageCreateEvts int)
        build_test.go:790: build-logs:
            {"stream":"Step 1/2 : FROM busybox"}
            {"stream":"\n"}
            {"stream":" ---\u003e 19d689bc58fd\n"}
            {"stream":"Step 2/2 : RUN echo hello \u003e /hello"}
            {"stream":"\n"}
            {"stream":" ---\u003e Running in 119e771bcb1a\n"}
            {"stream":" ---\u003e 289982143d91\n"}
            {"aux":{"ID":"sha256:289982143d912b1c11d95dddfb59640c175fb29a9a00f0223a1ad18972b6df74"}}
            {"stream":"Successfully built 289982143d91\n"}

        build_test.go:791: events received:
            type: container, action: create
            type: container, action: attach
            type: network, action: connect
            type: container, action: start
            type: network, action: disconnect
            type: container, action: die
            type: image, action: create
        --- FAIL: TestBuildEmitsImageCreateEvent/v1 (0.97s)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-16 13:43:05 +01:00
Paweł Gronowski
899360b649 integration/build_traces: Create own tracer provider
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-12-12 18:32:05 +01:00
Akihiro Suda
fb6e650ab9 integration: add wait
Cherry-picked several WIP commits from
b0a592798f/

Originally-authored-by: Rodrigo Campos <rodrigoca@microsoft.com>
Co-Authored-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-27 15:52:49 +01:00
Aleksa Sarai
caae3c051d tests: migrate to assert.ErrorContains when possible
If we have an error type that we're checking a substring against, we
should really be checking using ErrorContains to indicate the right
semantics to assert.

Mostly done using these transforms:

  find . -type f -name "*_test.go" | \
    xargs gofmt -w -r 'assert.Assert(t, is.ErrorContains(e, s)) -> assert.ErrorContains(t, e, s)'
  find . -type f -name "*_test.go" | \
    xargs gofmt -w -r 'assert.Assert(t, is.Contains(err.Error(), s)) -> assert.ErrorContains(t, err, s)'
  find . -type f -name "*_test.go" | \
    xargs gofmt -w -r 'assert.Check(t, is.Contains(err.Error(), s)) -> assert.Check(t, is.ErrorContains(err, s))'

As well as some small fixups to helpers that were doing
strings.Contains explicitly.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2024-11-22 23:59:21 +11:00
Sebastiaan van Stijn
08dbb7a593 integration/build: remove redundant capturing of loop vars (copyloopvar)
integration/build/build_test.go:95:3: The copy of the 'for' variable "c" can be deleted (Go 1.22+) (copyloopvar)
            c := c
            ^
    integration/build/build_test.go:615:3: The copy of the 'for' variable "tc" can be deleted (Go 1.22+) (copyloopvar)
            tc := tc
            ^
    integration/build/build_test.go:743:3: The copy of the 'for' variable "builderVersion" can be deleted (Go 1.22+) (copyloopvar)
            builderVersion := builderVersion
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-12 14:02:17 +01:00
Sebastiaan van Stijn
7fa6d3c230 integration/build: remove TestBuildWithSession, and fsutil direct dependency
This test was originally used to test the experimental `--stream` option with
the classic builder. This feature was removed in Docker 20.10 through
6ca3ec88ae, which also disabled the test
(adding a note to rewrite the test for BuildKit).

The above is 5 years ago, and we now run the BuildKit integration tests
as part of our CI, which (I assume) should cover this functionality.

Removing this test, as it depends on github.com/tonistiigi/fsutil, which
does not have a stable API, and frequently cannot be updated independently
from BuildKit.

Also adding a linter-rule to prevent it from accidentally being imported;

    errdefs/defs.go:3:8: import 'github.com/tonistiigi/fsutil' is not allowed from list 'main': The fsutil module does not have a stable API, so we should not have a direct dependency unless necessary. (depguard)
    import _ "github.com/tonistiigi/fsutil"
           ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-10 12:35:57 +02:00
Paweł Gronowski
f143f4ec51 image/save&load: Support Platform parameter
Add `Platform` parameter that allows to select a specific platform to
save/load.

This is a breaking change to the Go client as it changes the signatures
of `ImageLoad` and `ImageSave`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-09-11 19:44:35 +02:00
Paweł Gronowski
ab075ecd10 image/history: Support Platform parameter
Add `Platform` parameter that allows to select a specific platform to
show the history for.

This is a breaking change to the Go client as it changes the signature
of `ImageHistory`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-09-11 19:44:32 +02:00
CrazyMax
5ebc179cb1 test: update since session signature has changed
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-09-04 16:36:09 +02:00
Sebastiaan van Stijn
8e50a96a78 integration: gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-27 23:18:48 +02:00
Paweł Gronowski
7b8f4922a5 daemon: Emit Image Create event when image is built
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-06-17 14:05:12 +02:00
Paweł Gronowski
7532420f3b container/SetupWorkingDirectory: Don't mutate config
Don't mutate the container's `Config.WorkingDir` permanently with a
cleaned path when creating a working directory.

Move the `filepath.Clean` to the `translateWorkingDir` instead.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-04-19 12:42:20 +02:00
Paweł Gronowski
e68f71259a integration/build: Use fsutil.NewFS
StaticDirSource definition changed and can no longer be initialized from
the composite literal.

a80b48544c

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-02-27 11:26:10 +01:00
Paweł Gronowski
dd6992617e integration/build: Use new buildkit progressui
Introduced in: 37131781d7

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-02-27 11:26:09 +01:00
Sebastiaan van Stijn
64a6cc3afd integration/build: improve some asserts, and add asserts for unhandled errs
- add some asserts for unhandled errors
- use consts for fixed values, and slightly re-format Dockerfile contentt
- inline one-line Dockerfiles
- fix some vars to be properly camel-cased
- improve assert for error-types;

Before:

    === RUN   TestBuildPlatformInvalid
        build_test.go:685: assertion failed: expression is false: errdefs.IsInvalidParameter(err)
    --- FAIL: TestBuildPlatformInvalid (0.01s)
    FAIL

After:

    === RUN   TestBuildPlatformInvalid
        build_test.go:689: assertion failed: error is Error response from daemon: "foobar": unknown operating system or architecture: invalid argument (errdefs.errSystem), not errdefs.IsInvalidParameter
    --- FAIL: TestBuildPlatformInvalid (0.01s)
    FAIL

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-01-21 13:45:06 +01:00
Sebastiaan van Stijn
66cf6e3a7a rename "image" vars to prevent conflicts with imports
We have many "image" packages, so these vars easily conflict/shadow
imports. Let's rename them (and in some cases use a const) to
prevent that.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-01-19 12:49:53 +01:00
Paweł Gronowski
d5eba1bfe5 integration/build: Use setupTest
These tests build new images, setupTest sets up the test cleanup
function that clears the test environment from created images,
containers, etc.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-12-05 12:49:30 +01:00
Sebastiaan van Stijn
713c7d49a1 integration(-cli): remove skips for old daemon versions (<20.10)
This removes various skips that accounted for running the integration tests
against older versions of the daemon before 20.10 (API version v1.41). Those
versions are EOL, and we don't run tests against them.

This reverts most of e440831802, and similar
PRs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-05 01:03:50 +01:00
Sebastiaan van Stijn
3bfb6a9420 frozen images: update to debian:bookworm-slim
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-11-30 12:01:06 +01:00
Sebastiaan van Stijn
ebef4efb88 api/types: move ContainerLogsOptions to api/types/container
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-12 11:30:12 +02:00
Sebastiaan van Stijn
9670d9364d api/types: move ContainerListOptions to api/types/container
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-12 11:29:24 +02:00
Paweł Gronowski
0cd02ab1b4 integration/c8d: Skip TestBuildSquashParent
`docker build --squash` is an experimental feature which is not
implemented for containerd image store.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-10-11 15:45:43 +02:00
Bjorn Neergaard
c217e3c87a vendor: github.com/moby/buildkit v0.12.2
The following changes were required:
* integration/build: progressui's signature changed in 6b8fbed01e
* builder-next: flightcontrol.Group has become a generic type in 8ffc03b8f0
* builder-next/executor: add github.com/moby/buildkit/executor/resources types, necessitated by 6e87e4b455
* builder-next: stub util/network/Namespace.Sample(), necessitated by 963f16179f

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-09-21 14:18:45 -06:00
Brian Goff
9b7784781d Add test for buildkit history trace propagation
This test ensures that we are able to propagate traces into buildkit's
history API.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2023-09-07 18:38:22 +00:00
Brian Goff
e8dc902781 Wire up tests to support otel tracing
Integration tests will now configure clients to propagate traces as well
as create spans for all tests.

Some extra changes were needed (or desired for trace propagation) in the
test helpers to pass through tracing spans via context.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2023-09-07 18:38:22 +00:00
Sebastiaan van Stijn
07e6b0ac70 integration: format code with gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-24 17:55:14 +02:00
Paweł Gronowski
f9e2eed55d integration: Don't env cleanup before parallel subtests
Calling function returned from setupTest (which calls testEnv.Clean) in
a defer block inside a test that spawns parallel subtests caused the
cleanup function to be called before any of the subtest did anything.

Change the defer expressions to use `t.Cleanup` instead to call it only
after all subtests have also finished.
This only changes tests which have parallel subtests.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-07-13 13:41:00 +02:00
Cory Snider
0c68b655f6 Fix loop-closure bugs in tests
...which were flagged by golangci-lint v1.51.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-02-15 12:44:52 -05:00
Tonis Tiigi
666334bd48 vendor: update buildkit to v0.11.2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-02-01 23:29:10 -08:00
Brian Goff
402d106142 Merge pull request #43009 from thaJeztah/skip_TestBuildWCOWSandboxSize
testing: skip TestBuildWCOWSandboxSize for now
2021-11-10 11:59:09 -08:00
Sebastiaan van Stijn
2a6a4587fa testing: skip TestBuildWCOWSandboxSize for now
This test is failing frequently once nodes have less disk space
available. Skipping the test for now, but we can continue looking
for a good solution.

Tracked through https://github.com/moby/moby/issues/42743

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-11-10 15:38:22 +01:00
Sebastiaan van Stijn
eea2758761 TestBuildUserNamespaceValidateCapabilitiesAreV2: cleanup daemon storage
This should help with Jenkins failing to clean up the Workspace:

- make sure "cleanup" is also called in the defer for all daemons. keeping
  the daemon's storage around prevented Jenkins from cleaning up.
- close client connections and some readers (just to be sure)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-11-10 12:25:16 +01:00
Eng Zer Jun
c55a4ac779 refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated in Go 1.16. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-08-27 14:56:57 +08:00
Sebastiaan van Stijn
f68260ba22 Dockerfile: frozen images: update to bullseye, remove buildpack-dep
Update the frozen images to also be based on Debian bullseye. Using the "slim"
variant (which looks to have all we're currently using),  and remove the
buildpack-dep frozen image.

The buildpack-dep image is quite large, and it looks like we only use it to
compile some C binaries, which should work fine on a regular debian image;

    docker build -t debian:bullseye-slim-gcc -<<EOF
    FROM debian:bullseye-slim
    RUN apt-get update && apt-get install -y gcc libc6-dev --no-install-recommends
    EOF

    docker image ls

    REPOSITORY        TAG                 IMAGE ID       CREATED          SIZE
    debian            bullseye-slim-gcc   1851750242af   About a minute ago   255MB
    buildpack-deps    bullseye            fe8fece98de2   2 days ago           834MB

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-20 18:23:06 +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
Sebastiaan van Stijn
7c91fd4240 unused: ignore false positives
integration/build/build_session_test.go:92:6: func `testBuildWithSession` is unused (unused)
    func testBuildWithSession(t *testing.T, client dclient.APIClient, daemonHost string, dir, dockerfile string) (outStr string) {
         ^
    integration/container/checkpoint_test.go:23:6: func `containerExec` is unused (unused)
    func containerExec(t *testing.T, client client.APIClient, cID string, cmd []string) {
         ^
    integration/network/service_test.go:295:6: func `swarmIngressReady` is unused (unused)
    func swarmIngressReady(client client.NetworkAPIClient) func(log poll.LogT) poll.Result {
         ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-10 13:03:32 +02:00
Sebastiaan van Stijn
fa480403c7 TestBuildUserNamespaceValidateCapabilitiesAreV2: verify build completed
Check if the `docker build` completed successfully before continuing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-15 16:08:40 +01:00
Sebastiaan van Stijn
26965fbfa0 TestBuildUserNamespaceValidateCapabilitiesAreV2: use correct image name
This currently doesn't make a difference, because load.FrozenImagesLinux()
currently loads all frozen images, not just the specified one, but in case
that is fixed/implemented at some point.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-15 14:02:41 +01:00
Sebastiaan van Stijn
f266f13965 Merge pull request #41636 from TBBle/37352-test-and-fix
Set 127GB default sandbox size for WCOW, and ensure storage-opts is honoured on all paths under WCOW and LCOW
2021-01-25 14:34:34 +01:00
Sebastiaan van Stijn
41e5d459f1 Merge pull request #41865 from thaJeztah/load_frozen_images
integration: fix TestBuildUserNamespaceValidateCapabilitiesAreV2 not using frozen image
2021-01-13 18:50:22 +01:00
Sebastiaan van Stijn
46dfc31342 integration: fix TestBuildUserNamespaceValidateCapabilitiesAreV2 not using frozen image
Commit f2f5106c92 added this test to verify loading
of images that were built with user-namespaces enabled.

However, because this test spins up a new daemon, not the daemon that's set up by
the test-suite's `TestMain()` (which loads the frozen images).

As a result, the `debian:bullseye` image was pulled from Docker Hub when running
the test;

    Calling POST /v1.41/images/load?quiet=1
    Applying tar in /go/src/github.com/docker/docker/bundles/test-integration/TestBuildUserNamespaceValidateCapabilitiesAreV2/d4d366b15997b/root/165536.165536/overlay2/3f7f9375197667acaf7bc810b34689c21f8fed9c52c6765c032497092ca023d6/diff" storage-driver=overlay
    Applied tar sha256:845f0e5159140e9dbcad00c0326c2a506fbe375aa1c229c43f082867d283149c to 3f7f9375197667acaf7bc810b34689c21f8fed9c52c6765c032497092ca023d6, size: 5922359
    Calling POST /v1.41/build?buildargs=null&cachefrom=null&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=&labels=null&memory=0&memswap=0&networkmode=&rm=0&shmsize=0&t=capabilities%3A1.0&target=&ulimits=null&version=
    Trying to pull debian from https://registry-1.docker.io v2
    Fetching manifest from remote" digest="sha256:f169dbadc9021fc0b08e371d50a772809286a167f62a8b6ae86e4745878d283d" error="<nil>" remote="docker.io/library/debian:bullseye
    Pulling ref from V2 registry: debian:bullseye
    ...

This patch updates `TestBuildUserNamespaceValidateCapabilitiesAreV2` to load the
frozen image. `StartWithBusybox` is also changed to `Start`, because the test
is not using the busybox image, so there's no need to load it.

In a followup, we should probably add some utilities to make this easier to set up
(and to allow passing the list frozen images that we want to load, without having
to "hard-code" the image name to load).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-01-08 13:25:21 +01:00
Eric Mountain
95eb490780 Use v2 capabilities in layer archives
When building images in a user-namespaced container, v3 capabilities are
stored including the root UID of the creator of the user-namespace.

This UID does not make sense outside the build environment however. If
the image is run in a non-user-namespaced runtime, or if a user-namespaced
runtime uses a different UID, the capabilities requested by the effective
bit will not be honoured by `execve(2)` due to this mismatch.

Instead, we convert v3 capabilities to v2, dropping the root UID on the
fly.

Signed-off-by: Eric Mountain <eric.mountain@datadoghq.com>
2020-12-23 14:16:41 +01:00
Eric Mountain
f2f5106c92 Add a test for #41723
Capabilities are serialised in VFS_CAP_REVISION_3 when an image is
built in a user-namespaced daemon, instead of VFS_CAP_REVISION_2.

This adds a test for this, though it's currently wired to fail if
the capabilities are serialised in VFS_CAP_REVISION_2 instead in this
situation, since this is unexpected.

Signed-off-by: Eric Mountain <eric.mountain@datadoghq.com>
2020-12-18 07:51:44 +01:00
Paul "TBBle" Hampson
695b151a18 Work around small disk on Windows-RS5 CI nodes
The free disk space on the Windows RS5 CI nodes appears to be just the
right size that the TestBuildWCOWSandboxSize test can generate 21GB of
layers, and then a 21GB sandbox inside a container, and then runs out of
space while committing the layer.

Helpfully, this failure is distinguishable in the logs from a failure
when the sandbox is too small, so we can do that.

TODO: Revert this if-and-when the Windows-RS5 CI nodes have more free
space.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-11-10 19:51:46 +11:00
Paul "TBBle" Hampson
142b2b785b Add TestBuildWCOWSandboxSize integration test
This test validates that `RUN` and `COPY` both target a read-write
sandbox on Windows that is configured according to the daemon's
`storage-opts` setting.

Sadly, this is a slow test, so we need to bump the timeout to 60 minutes
from the default of 10 minutes.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-11-10 19:51:46 +11:00
Tibor Vass
29b149ebb1 Merge pull request #41430 from TBBle/40444-update-gowinio-for-8gB-file-fix
Revendor Microsoft/go-winio for 8gB file fix when importing or committing image layers
2020-09-24 11:16:10 -07:00