Commit Graph

7994 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 72ed7bd3e9
scripts/build: fix date formatting on macOS
This was introduced in 9d40c7464e, which added
support for `SOURCE_DATE_EPOCH` to override the build-time.

macOS uses the BSD flavor of `date`, which does not support the `--date` option
to set a custom time.

Before this:

    DISABLE_WARN_OUTSIDE_CONTAINER=1 make binary
    ./scripts/build/binary
    date: illegal option -- -
    usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
    [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]

After this:

    DISABLE_WARN_OUTSIDE_CONTAINER=1 make binary
    ./scripts/build/binary
    Building static docker-darwin-amd64
    + go build -o build/docker-darwin-amd64 -tags ' osusergo pkcs11' -ldflags ' -w -X "github.com/docker/cli/cli/version.GitCommit=a4b6fe16a" -X "github.com/docker/cli/cli/version.BuildTime=2022-04-06T10:57:25Z" -X "github.com/docker/cli/cli/version.Version=20.10.2-589-ga4b6fe16a.m"' -buildmode=pie github.com/docker/cli/cmd/docker
    ...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-06 11:30:19 +02:00
Sebastiaan van Stijn b82d9a7742
Merge pull request #3529 from thaJeztah/bump_buildx_0.8.2
Dockerfile: update buildx to v0.8.2
2022-04-04 10:55:51 +02:00
Sebastiaan van Stijn bcd4101f3d
tweak description of login/logout
Remove "Docker" from registry, as the registry specification is no
longer docker-specific, but part of the OCI distribution spec.

Also removed "Register" from one of the docs pages, as the login
command hasn't supported creating a new acccount on Docker Hub for
a long time.

I'm wondering if we should be more explicit about what log in / out
does (effectively; authenticate, and on success store the credentials
or token, and on log out; remove credentials/token).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-04 10:44:11 +02:00
Sebastiaan van Stijn 028d5c39ba
Dockerfile: update buildx to v0.8.2
release notes: https://github.com/docker/buildx/releases/tag/v0.8.2

Notable changes:

- Update Compose spec used by buildx bake to v1.2.1 to fix parsing ports definition
- Fix possible crash on handling progress streams from BuildKit v0.10
- Fix parsing groups in buildx bake when already loaded by a parent group

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-04 10:34:49 +02:00
Sebastiaan van Stijn a4b6fe16ae
Merge pull request #3419 from iainelder/patch-1
Describe privileged mode in terms of capabilities
2022-04-02 00:13:50 +02:00
Sebastiaan van Stijn 984b580cab
Merge pull request #3524 from thaJeztah/docs_fix_yaml_formatting
docs: reference: remove trailing space to fix yaml formatting
2022-04-01 21:49:31 +02:00
Sebastiaan van Stijn 4b35192d7c
docs: reference: remove trailing space to fix yaml formatting
This was introduced in 41a5e0e4df, and
having the trailing whitespace causes the yamldocs generator to
switch to "compact" formatting, which makes that yaml hard to read.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-01 21:31:14 +02:00
Sebastiaan van Stijn fae3eb6ddb
Merge pull request #3509 from thaJeztah/docs_anchors
docs: add anchor tags for command-line flags
2022-04-01 20:40:16 +02:00
Sebastiaan van Stijn dcb13bb110
Merge pull request #3508 from thaJeztah/tweak_command_descriptions
Tweak description of some commands
2022-04-01 19:44:26 +02:00
Sebastiaan van Stijn b7b923db41
tweak description of "docker push" and "docker pull" commands
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-01 12:33:05 +02:00
Sebastiaan van Stijn 6e6652b702
tweak description of "docker run" command
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-01 12:28:37 +02:00
Sebastiaan van Stijn ac22b2bf52
tweak description of "docker exec" command
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-01 12:28:34 +02:00
Sebastiaan van Stijn c23d45f0c9
Merge pull request #3519 from crazy-max/fix-version-quad-2
fix version quad logic that trims 0 digit so returns an empty one
2022-03-31 22:56:15 +02:00
Sebastiaan van Stijn 9688f62d20
fix race condition in TestRemoveForce
This test uses two subtests that were sharing the same variable.
Subtests run in a goroutine, which could lead to them concurrently
accessing the variable, resulting in a panic:

    === FAIL: cli/command/container TestRemoveForce/without_force (0.00s)
    Error: Error: No such container: nosuchcontainer
        --- FAIL: TestRemoveForce/without_force (0.00s)
    panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    	panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x40393f]
    goroutine 190 [running]:
    testing.tRunner.func1.2({0xb76380, 0x124c9a0})
    	/usr/local/go/src/testing/testing.go:1389 +0x24e
    testing.tRunner.func1()
    	/usr/local/go/src/testing/testing.go:1392 +0x39f
    panic({0xb76380, 0x124c9a0})
    	/usr/local/go/src/runtime/panic.go:838 +0x207
    sort.StringSlice.Less(...)
    	/usr/local/go/src/sort/sort.go:319
    sort.insertionSort({0xd87380, 0xc00051b3b0}, 0x0, 0x2)
    	/usr/local/go/src/sort/sort.go:40 +0xb1
    sort.quickSort({0xd87380, 0xc00051b3b0}, 0x18?, 0xb4f060?, 0xc000540e01?)
    	/usr/local/go/src/sort/sort.go:222 +0x171
    sort.Sort({0xd87380, 0xc00051b3b0})
    	/usr/local/go/src/sort/sort.go:231 +0x53
    sort.Strings(...)
    	/usr/local/go/src/sort/sort.go:335
    github.com/docker/cli/cli/command/container.TestRemoveForce.func2(0xc0005389c0?)
    	/go/src/github.com/docker/cli/cli/command/container/rm_test.go:36 +0x125
    testing.tRunner(0xc00053e4e0, 0xc00051b140)
    	/usr/local/go/src/testing/testing.go:1439 +0x102
    created by testing.(*T).Run
    	/usr/local/go/src/testing/testing.go:1486 +0x35f
    === FAIL: cli/command/container TestRemoveForce (0.00s)

This patch changes the test to use to separate variables.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-31 22:54:17 +02:00
CrazyMax 22edabb584
fix version quad logic that trims 0 digit so returns an empty one
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-03-31 21:14:29 +02:00
Sebastiaan van Stijn b1ce915a3b
Merge pull request #3517 from crazy-max/fix-version-quad
trim leading 0 for minor in the version quad
2022-03-31 16:10:22 +02:00
CrazyMax 525845572a
trim leading 0 for minor in the version quad
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-03-31 15:54:39 +02:00
Sebastiaan van Stijn 58d425d3bf
Merge pull request #3511 from thaJeztah/remove_engine_active_deadcode
registry: remove some dead code / leftovers from "engine activate"
2022-03-31 14:21:24 +02:00
Nicolas De loof abe41ad309
Merge pull request #3513 from thaJeztah/fix_ldflags
use GO_LDFLAGS instead of LDFLAGS to prevent inheriting unrelated options
2022-03-31 11:50:04 +02:00
Sebastiaan van Stijn 391e6ad944
use GO_LDFLAGS instead of LDFLAGS to prevent inheriting unrelated options
When building on Fedora 36, the build failed. I suspect this is because the
rpm tools also set LDFLAGS, but with options that cannot be used;

    GO_LINKMODE=dynamic
    + ./scripts/build/binary
      /go/src/github.com/docker/cli ~/rpmbuild/BUILD/src
      Building dynamic docker-linux-arm64
      + go build -o build/docker-linux-arm64 -tags ' pkcs11' -ldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -Wl,-dT,/root/rpmbuild/BUILD/src/.package_note-docker-ce-cli-0.0.0.20220330082637.68cad50-0.fc36.aarch64.ld -w -X "github.com/docker/cli/cli/version.GitCommit=68cad50" -X "github.com/docker/cli/cli/version.BuildTime=2022-03-30T20:05:36Z" -X "github.com/docker/cli/cli/version.Version=0.0.0-20220330082637-68cad50" -X "github.com/docker/cli/cli/version.PlatformName=Docker Engine - Community"' -buildmode=pie github.com/docker/cli/cmd/docker
    # github.com/docker/cli/cmd/docker
    flag provided but not defined: -Wl,-z,relro
    usage: link [options] main.o

This patch changes the variable we use to `GO_LDFLAGS`, taking a similar approach
as containerd, and various other projects using this name: https://grep.app/search?q=GO_LDFLAGS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-31 10:30:56 +02:00
Sebastiaan van Stijn 801113fb8d
cli/registry/client: remove unused IsNotFound(), and slight refactor
This function was not used anywhere, and the error type already satisfied
the github.com/docker/docker/errdefs.ErrNotFound interface, so let's remove
this utility and (if needed at some point) use errdefs.IsNotFound() instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 20:00:36 +02:00
Sebastiaan van Stijn 48745da16c
cli/registry/client: remove unused RegistryClient.GetTags()
This was added in fd2f1b3b66 as part of
the `docker engine` sub-commands, which were deprecated, and removed in
43b2f52d0c.

This function is not used by anyone, so safe to remove.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 20:00:34 +02:00
Sebastiaan van Stijn e83d6cd2c8
cli/registry/client: remove unused GetRegistryAuth()
This was added in fd2f1b3b66 as part of
the `docker engine` sub-commands, which were deprecated, and removed
in 43b2f52d0c.

This function is not used by anyone, so safe to remove.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 20:00:32 +02:00
Sebastiaan van Stijn 04347f793d
context: Endpoint.ClientOpts(): use client.WithVersionFromEnv()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 17:42:23 +02:00
Sebastiaan van Stijn 1db2da57c8
use client consts for environment variable names
It's slightly more verbose, but helps finding the purpose of each
of the environment variables. In tests, I kept the fixed strings.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 17:42:20 +02:00
Sebastiaan van Stijn 2b976720f4
docs: add anchor-tags for flags
This will generate "details_url" for options, so that the options
table on the pages at docs.docker.com link to the section describing
the option.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 15:05:29 +02:00
Sebastiaan van Stijn 885f44a5ba
docs: fix (table) formatting, fix some broken links
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 15:03:25 +02:00
Sebastiaan van Stijn b87a0c1b03
docs: build: add named anchor tags for flags
With this, the sections are linked from the "options" table when
producing the documentation on docs.docker.com

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 12:42:26 +02:00
Sebastiaan van Stijn 7d4ae13753
docs: build: fix minor markdown and syntax issues
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 12:37:35 +02:00
Sebastiaan van Stijn 68cad50f61
Merge pull request #3471 from thaJeztah/no_search_limit
search: remove client-side default for --limit
2022-03-30 10:26:37 +02:00
Sebastiaan van Stijn ccbaaf0722
search: remove client-side default for --limit
The daemon (and registry) already have a default limit. This patch
removes the default from the client side, to not duplicate setting
these defaults.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 10:05:43 +02:00
Sebastiaan van Stijn 2dc178c802
search: change "the Docker Hub" to just "Docker Hub"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 10:05:12 +02:00
Sebastiaan van Stijn f00c06f6c6
docs: commandline/index.md: reformat tables
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-30 00:06:04 +02:00
Sebastiaan van Stijn 1ca6b84055
Merge pull request #3507 from thaJeztah/bump_buildx
Dockerfile: update buildx to v0.8.1
2022-03-29 17:05:06 +02:00
Sebastiaan van Stijn a3c4a42d4e
Dockerfile: update buildx to v0.8.1
This only affects the version used in the dev container, but
I noticed it was an older version of buildx.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-29 15:37:35 +02:00
Sebastiaan van Stijn 174e51cc94
Merge pull request #3486 from thaJeztah/update_engine
vendor: github.com/docker/docker 4a26fdda76d996708aa8100dd23ea90215984451
2022-03-29 10:31:12 +02:00
Sebastiaan van Stijn 6e9210e994
Merge pull request #3501 from thaJeztah/bump_go_1.18
update go to 1.18.0
2022-03-29 09:54:05 +02:00
Sebastiaan van Stijn ace0ec599d
Merge pull request #3504 from thaJeztah/fix_flaky_tests
Fix flaky TestContainerList tests
2022-03-28 22:10:39 +02:00
Sebastiaan van Stijn 8e2d63d5df
Fix flaky TestContainerList tests
These tests were creating a stub container, using the current timestamp as
created date. However, if CI was slow to run the test, `Less than a second ago`
would change into `1 second ago`, causing the test to fail:

    --- FAIL: TestContainerListNoTrunc (0.00s)
        list_test.go:198: assertion failed:
            --- expected
            +++ actual
            @@ -1,4 +1,4 @@
            -CONTAINER ID   IMAGE            COMMAND   CREATED                  STATUS        PORTS     NAMES
            -container_id   busybox:latest   "top"     Less than a second ago   Up 1 second             c1
            -container_id   busybox:latest   "top"     Less than a second ago   Up 1 second             c2,foo/bar
            +CONTAINER ID   IMAGE            COMMAND   CREATED        STATUS        PORTS     NAMES
            +container_id   busybox:latest   "top"     1 second ago   Up 1 second             c1
            +container_id   busybox:latest   "top"     1 second ago   Up 1 second             c2,foo/bar

This patch changes the "created" time of the container to be a minute ago. This
will result in `About a minute ago`, with a margin of 1 minute.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-28 20:37:06 +02:00
Sebastiaan van Stijn 635c55d52f
update go to 1.18.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-28 17:23:09 +02:00
Sebastiaan van Stijn bf29b40a8c
staticcheck: ignore SA1019: strings.Title is deprecated
This function is deprecated because it has known limitations when using
with multi-byte strings. This limitations are quite "corner case", and
our use (mostly) is for ASCII strings. The suggestion replacement brings
20k+ lines of code, which is a bit too much to fix those corner cases.

    templates/templates.go:23:14: SA1019: strings.Title is deprecated: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (staticcheck)
        "title":    strings.Title,
                    ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-28 17:23:06 +02:00
Sebastiaan van Stijn a1e67401d2
vendor: github.com/docker/docker 8941dcfcc5db4aefc351cd5b5bb4d524823035c0
- updated the default value for `--limit` on `docker search` as the const has been
  removed (added a todo to remove it)
- updated some fixtures to account for `KernelMemoryTCP` no longer being included
  in the output.

full diff: 83b51522df...8941dcfcc5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-28 17:21:59 +02:00
Sebastiaan van Stijn 5a1e151c02
Merge pull request #3493 from thaJeztah/bump_to_bullseye
Update to debian bullseye
2022-03-28 16:24:00 +02:00
Sebastiaan van Stijn dce5929794
Update to debian bullseye
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-28 16:00:46 +02:00
Tonis Tiigi d45030380d
Dockerfile: prefer ld for cross-compiling arm64 in bullseye
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-03-28 15:43:27 +02:00
Nicolas De loof 75c923a962
Merge pull request #3492 from thaJeztah/bump_cobra_1.4
Bump cobra to v1.4.0
2022-03-28 15:31:10 +02:00
Nicolas De loof 0bcf197ae7
Merge pull request #3497 from thaJeztah/cleanup_e2e_help_test
e2e: cleanup TestGlobalHelp() to be less brittle
2022-03-28 15:30:18 +02:00
Sebastiaan van Stijn 9fe6cb4b39
Merge pull request #3502 from thaJeztah/bump_golangci_lint
lint: update golangci-lint to v1.45.2
2022-03-28 11:29:41 +02:00
Sebastiaan van Stijn 3ffe6a3375
lint: update golangci-lint to v1.45.2
Also removed deprecated linters:

The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner.
The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner.  Replaced by revive.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-28 10:37:27 +02:00
Sebastiaan van Stijn 4ab70bf61e
linting: fix incorrectly formatted errors (revive)
cli/compose/interpolation/interpolation.go:102:4: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
                "invalid interpolation format for %s: %#v. You may need to escape any $ with another $.",
                ^

    cli/command/stack/loader/loader.go:30:30: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
                return nil, errors.Errorf("Compose file contains unsupported options:\n\n%s\n",
                                          ^

    cli/command/formatter/formatter.go:76:30: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
            return tmpl, errors.Errorf("Template parsing error: %v\n", err)
                                       ^

    cli/command/formatter/formatter.go:97:24: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
            return errors.Errorf("Template parsing error: %v\n", err)
                                 ^

    cli/command/image/build.go:257:25: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
                return errors.Errorf("error checking context: '%s'.", err)
                                     ^

    cli/command/volume/create.go:35:27: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
                        return errors.Errorf("Conflicting options: either specify --name or provide positional arg, not both\n")
                                             ^

    cli/command/container/create.go:160:24: error-strings: error strings should not be capitalized or end with punctuation or a newline (revive)
            return errors.Errorf("failed to remove the CID file '%s': %s \n", cid.path, err)
                                 ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-28 10:37:25 +02:00