Commit Graph

10151 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 13053ef538
Merge 38b3e792fd into d5b327258f 2024-11-14 10:42:29 +01:00
Sebastiaan van Stijn d5b327258f
Merge pull request #5612 from thaJeztah/27.x_backport_docs
[27.x backport] assorted docs updates
2024-11-14 10:42:14 +01:00
Sebastiaan van Stijn 38b3e792fd
[27.x] vendor: github.com/docker/docker b2c682be5f56 (v27.4-dev)
full diff: https://github.com/docker/docker/compare/v27.3.1...b2c682be5f564919135e063e28a57c7a2011e555

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-14 10:28:21 +01:00
Sebastiaan van Stijn 2958a27e0f
Merge pull request #5610 from thaJeztah/27.x_backport_moby_deps
[27.x backport] dependency updates for moby/moby
2024-11-14 10:27:53 +01:00
David Karlsson 2734299993
docs: update example redis tags from 3.0.x to 7.4.x
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit 172f340112)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-13 23:37:40 +01:00
Noah Silas 9d5a2a6b66
docs: Correct `run` exit code 126 description
The command to run inside the container is `/etc`. The semicolon is a
statement terminator, which ends the command `docker run busybox /etc`,
while `echo $?` prints the exit code of that full docker command.

Having this mistake could confuse someone who thinks that `/etc; echo
$?` is all run inside the container, which wouldn't help the reader
understand the exit code of the `docker run` command itself.

Signed-off-by: Noah Silas <noah@hustle.com>
(cherry picked from commit 0c999fe95b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-13 23:37:10 +01:00
Paul Rogalski 0dd07f0bfd
docs: Link supported Go duration strings
Signed-off-by: Paul Rogalski <mail@paul-rogalski.de>
(cherry picked from commit c70b2165a9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-13 23:36:58 +01:00
Sebastiaan van Stijn 46844b4f1d
vendor: github.com/klauspost/compress v1.17.11
full diff: https://github.com/klauspost/compress/compare/v1.17.9...v1.17.11

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e3942d46a0)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-13 23:01:16 +01:00
Sebastiaan van Stijn 3f28d05292
vendor: google.golang.org/protobuf v1.35.1
full diff: https://github.com/protocolbuffers/protobuf-go/compare/v1.34.1...v1.35.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 1bba009944)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-13 23:00:49 +01:00
Sebastiaan van Stijn 2521abdb1b
vendor: golang.org/x/sys v0.26.0
full diff: https://github.com/golang/sys/compare/v0.25.0...v0.26.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 02b92c699d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-13 22:59:20 +01:00
Sebastiaan van Stijn eb986ae71b
Merge pull request #5603 from dvdksn/bp_5600
[27.x backport] docs: change link to desktop docs
2024-11-07 13:57:54 +01:00
Sebastiaan van Stijn f39012209b
Merge pull request #5602 from vvoland/update-go-27.x
[27.x] update to go1.22.9
2024-11-07 13:54:26 +01:00
aevesdocker e15a979e3d docs: change link to desktop docs
Signed-off-by: aevesdocker <allie.sadler@docker.com>
(cherry picked from commit 1440f9f8cf)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-11-07 13:29:04 +01:00
Paweł Gronowski 35c87e326c
update to go1.22.9
- https://github.com/golang/go/issues?q=milestone%3AGo1.22.9+label%3ACherryPickApproved
- full diff: https://github.com/golang/go/compare/go1.22.8...go1.22.9

go1.22.9 (released 2024-11-06) includes fixes to the linker. See the
[Go 1.22.9 milestone](https://github.com/golang/go/issues?q=milestone%3AGo1.22.9+label%3ACherryPickApproved)
for details.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-07 13:23:41 +01:00
Sebastiaan van Stijn f4f328b84b
Merge pull request #5588 from vvoland/5586-27.x
[27.x backport] Buffer 'docker stats' text to avoid terminal flickering
2024-10-31 22:07:21 +01:00
Giedrius Jonikas 470ab05503
Buffer 'docker stats' text to avoid terminal flickering
This change reduces the flickering of the terminal when
running `docker stats` by buffering the formatted stats
text and printing it in one write.

Should also consume less CPU as we now only have to issue
a single syscall to write the stats text to the terminal.

Signed-off-by: Giedrius Jonikas <giedriusj1@gmail.com>
(cherry picked from commit 0b16070ae6)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-10-31 14:29:38 +01:00
Laura Brehm 968506fd0f
Merge pull request #5569 from thaJeztah/27.x_backport_login_idempotent 2024-10-22 16:18:18 +01:00
Sebastiaan van Stijn 6736be779a
cli/config/credentials: add test for save being idempotent
Test case for d3f6867e4d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3c78069240)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-22 12:23:27 +02:00
Sebastiaan van Stijn 720da3c65a
cil/config/credentials: remove newStore() test-utility
This function was names slightly confusing, as it returns a fakeStore,
and it didn't do any constructing, so didn't provide value above just
constructing the type.

I'm planning to add more functionality to the fakeStore, but don't want
to maintain a full-fledged constructor for all of that, so let's remove
this utility.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 0dd6f7f1b3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-22 12:15:34 +02:00
Sebastiaan van Stijn 05c860e866
Merge pull request #5548 from thaJeztah/27.x_backport_plugin_better_error
[27.x backport] cli/command/plugins: use errors.Join instead of custom cli.Errors, and deprecate cli.Errors
2024-10-22 10:42:38 +02:00
Sebastiaan van Stijn 365e7a5a4e
cli/config/credentials: skip saving config-file if credentials didn't change
Before this change, the config-file was always updated, even if there
were no changes to save. This could cause issues when the config-file
already had credentials set and was read-only for the current user.

For example, on NixOS, this poses a problem because `config.json` is a
symlink to a write-protected file;

    $ readlink ~/.docker/config.json
    /home/username/.config/sops-nix/secrets/ghcr_auth

    $ readlink -f ~/.docker/config.json
    /run/user/1000/secrets.d/28/ghcr_auth

Which causes `docker login` to fail, even if no changes were to be made;

    Error saving credentials: rename /home/derek/.docker/config.json2180380217 /home/username/.config/sops-nix/secrets/ghcr_auth: invalid cross-device link

This patch updates the code to only update the config file if changes
were detected. It there's nothing to save, it skips updating the file,
as well as skips printing the warning about credentials being stored
insecurely.

With this patch applied:

    $ docker login -u yourname
    Password:

    WARNING! Your credentials are stored unencrypted in '/root/.docker/config.json'.
    Configure a credential helper to remove this warning. See
    https://docs.docker.com/go/credential-store/

    Login Succeeded

    $ docker login -u yourname
    Password:
    Login Succeeded

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d3f6867e4d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-22 00:21:18 +02:00
Sebastiaan van Stijn 79113a3db5
Merge pull request #5564 from austinvazquez/cherry-pick-35d7b1a7a6426080f44e044b6564cee990b35eab-to-27.x
[27.x backport] cli/command/container: set empty args in tests and discard output
2024-10-21 23:21:51 +02:00
Sebastiaan van Stijn df7e6e5c5f
cli/command/container: TestWaitExitOrRemoved use subtests
=== RUN   TestWaitExitOrRemoved
    === RUN   TestWaitExitOrRemoved/normal-container
    === RUN   TestWaitExitOrRemoved/give-me-exit-code-42
    === RUN   TestWaitExitOrRemoved/i-want-a-wait-error
    time="2024-10-13T18:48:14+02:00" level=error msg="Error waiting for container: removal failed"
    === RUN   TestWaitExitOrRemoved/non-existent-container-id
    time="2024-10-13T18:48:14+02:00" level=error msg="error waiting for container: no such container: non-existent-container-id"
    --- PASS: TestWaitExitOrRemoved (0.00s)
        --- PASS: TestWaitExitOrRemoved/normal-container (0.00s)
        --- PASS: TestWaitExitOrRemoved/give-me-exit-code-42 (0.00s)
        --- PASS: TestWaitExitOrRemoved/i-want-a-wait-error (0.00s)
        --- PASS: TestWaitExitOrRemoved/non-existent-container-id (0.00s)
    PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 35d7b1a7a6)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-10-21 15:53:20 +00:00
Sebastiaan van Stijn 254b966b0d
cli/command/container: set empty args in tests and discard output
Prevent some tests from failing when running from a pre-compiled
testbinary, and discard output to make the output less noisy.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3b38dc67be)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-10-21 15:53:09 +00:00
Laura Brehm 220033dd80
Merge pull request #5552 from thaJeztah/27.x_backport_fix_ConfigureAuth_deprecation 2024-10-21 16:42:49 +01:00
Sebastiaan van Stijn dd013610c6
Merge pull request #5563 from vvoland/5554-27.x
[27.x backport] Fix bash completion for `events --filter daemon=`
2024-10-21 11:37:57 +02:00
Harald Albers dc36908ec5
Fix bash completion for `events --filter daemon=`
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 3f7b156c85)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-10-21 11:12:35 +02:00
Sebastiaan van Stijn a8a8f68268
cli/command: ConfigureAuth: fix deprecation comment
Deprecation comments must have an empty line before them, otherwise tools
and linters may not recognise them. While fixing this, also updated the
reference to PromptUserForCredentials to be a docs-link to make it clickable.

Updates 6e4818e7d6.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 54e3685bcd)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-19 13:10:31 +02:00
Sebastiaan van Stijn b3a55ecbba
cli: deprecate Errors type
The Errors type is no longer used by the CLI itself, and this custom
"multi-error" implementation had both limitations (empty list not being
`nil`), as well as formatting not being great. All of this making it not
something to recommend, and better handled with Go's stdlib.

As far as I could find, there's no external consumers of this, but let's
deprecate first, and remove in the next release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d3bafa5f3e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-19 10:36:33 +02:00
Sebastiaan van Stijn d3bf82db86
cli/command/plugins: use errors.Join instead of custom cli.Errors
This command was using a custom "multi-error" implementation, but it
had some limitations, and the formatting wasn't great.

This patch replaces it with Go's errors.Join.

Before:

    docker plugin remove one two three
    Error response from daemon: plugin "one" not found, Error response from daemon: plugin "two" not found, Error response from daemon: plugin "three" not found

After:

    docker plugin remove one two three
    Error response from daemon: plugin "one" not found
    Error response from daemon: plugin "two" not found
    Error response from daemon: plugin "three" not found

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 71ebbb81ae)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-19 10:36:33 +02:00
Sebastiaan van Stijn 0008d79159
Merge pull request #5543 from thaJeztah/27.x_backport_bump_swarmkit
[27.x backport] vendor: github.com/moby/swarmkit/v2 v2.0.0-20241017191044-e8ecf83ee08e
2024-10-18 11:50:01 +02:00
Sebastiaan van Stijn 16201b3eb2
vendor: github.com/moby/swarmkit/v2 v2.0.0-20241017191044-e8ecf83ee08e
- add Unwrap error to custom error types
- removes dependency on github.com/rexray/gocsi
- fix CSI plugin load issue

full diff: ea1a7cec35...e8ecf83ee0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit cbbb917323)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-18 11:38:19 +02:00
Paweł Gronowski 4241e00d1d
Merge pull request #5540 from thaJeztah/27.x_backport_completion_improvements
[27.x backport] assorted improvements for shell completion
2024-10-18 10:48:48 +02:00
Harald Albers b018e55ca4
Only complete removable containers if --force is not given
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 147630a309)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:43:03 +02:00
Sebastiaan van Stijn e2831282ee
completion: add test for VolumeNames
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e1c472a436)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:43:03 +02:00
Sebastiaan van Stijn b68bf3afe4
completion: add test for NetworkNames
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 302d73f990)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:43:03 +02:00
Sebastiaan van Stijn 77d002ae25
completion: add test for ImageNames
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ab418a38d8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:43:01 +02:00
Sebastiaan van Stijn 95e329d3e3
completion: add test for ContainerNames
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f3b4094eb0)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:42:10 +02:00
Sebastiaan van Stijn 02da13fb18
completion: add test for NoComplete
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit be197da6b8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:11:05 +02:00
Sebastiaan van Stijn 62230c7ec2
completion: add test for FromList
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 51713196c9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:11:05 +02:00
Sebastiaan van Stijn 954dba4482
completion: add test for FileNames
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a5ca5b33f1)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:11:05 +02:00
Sebastiaan van Stijn 7d1fa132fb
completion: add test for EnvVarNames
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8f2e5662e7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:11:05 +02:00
Sebastiaan van Stijn b6e7eba447
completion: ContainerNames: don't panic on nil filter
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b8cddc63ad)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:11:04 +02:00
Sebastiaan van Stijn 099d4baeed
cli/command/image: add shell completion for --platform flags
With this patch, completion is provided for `--platform` flags:

    docker pull --platform<TAB>
    linux           linux/amd64     linux/arm/v5    linux/arm/v7    linux/arm64/v8  linux/riscv64   wasip1          windows
    linux/386       linux/arm       linux/arm/v6    linux/arm64     linux/ppc64le   linux/s390x     wasip1/wasm     windows/amd64

Note that `docker buildx build` (with BuildKit) does not yet provide completion;
it's provided through buildx, and uses a different format (accepting multiple
comma-separated platforms). Interestingly, tab-completion for `docker build`
currently uses completion for non-buildkit, and has some other issues that may
have to be looked into.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d42cf96e15)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:10:59 +02:00
Sebastiaan van Stijn dd4b370d3c
cli/command/container: add shell completion for --platform flags
With this patch, completion is provided for `--platform` flags:

    docker run --platform<TAB>
    linux           linux/amd64     linux/arm/v5    linux/arm/v7    linux/arm64/v8  linux/riscv64   wasip1          windows
    linux/386       linux/arm       linux/arm/v6    linux/arm64     linux/ppc64le   linux/s390x     wasip1/wasm     windows/amd64

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8c7f713db6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:10:59 +02:00
Sebastiaan van Stijn 64e98fa375
cli/command/completion: add Platforms
Add a utility for completing platform strings.

Platforms offers completion for platform-strings. It provides a non-exhaustive
list of platforms to be used for completion. Platform-strings are based on
[runtime.GOOS] and [runtime.GOARCH], but with (optional) variants added. A
list of recognised os/arch combinations from the Go runtime can be obtained
through "go tool dist list".

Some noteworthy exclusions from this list:

  - arm64 images ("windows/arm64", "windows/arm64/v8") do not yet exist for windows.
  - we don't (yet) include `os-variant` for completion (as can be used for Windows images)
  - we don't (yet) include platforms for which we don't build binaries, such as
    BSD platforms (freebsd, netbsd, openbsd), android, macOS (darwin).
  - we currently exclude architectures that may have unofficial builds,
    but don't have wide adoption (and no support), such as loong64, mipsXXX,
    ppc64 (non-le) to prevent confusion.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ce1aebcc30)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:10:58 +02:00
Sebastiaan van Stijn e6c6658563
cli/command/container: add unit tests for completion helpers
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d49e72c0ac)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:08:29 +02:00
Sebastiaan van Stijn 52ac568385
cli/container: use github.com/moby/sys/capability for completions
We used a hard-coded list of capabilities that we copied from containerd,
but the new "capability" package allows use to have a maintained list
of capabilities.

There's likely still some improvements to be made;

First of all, the capability package could provide a function to get the list
of strings.

On the completion-side, we need to consider what format is most convenient;
currently we use the canonical name (uppercase and "CAP_" prefix), however,
tab-completion is case-sensitive by default, so requires the user to type
uppercase letters to filter the list of options.

Bash completion provides a `completion-ignore-case on` option to make completion
case-insensitive (https://askubuntu.com/a/87066), but it looks to be a global
option; the current cobra.CompletionOptions also don't provide this as an option
to be used in the generated completion-script.

Fish completion has `smartcase` (by default?) which matches any case if
all of the input is lowercase.

Zsh does not have a dedicated option, but allows setting matching-rules
(see https://superuser.com/a/1092328).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 462e08219d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:08:14 +02:00
Sebastiaan van Stijn 9e2d548799
Merge pull request #5530 from thaJeztah/27.x_backport_bump_deps
[27.x backport] vendor assorted dependencies in preparation of engine update
2024-10-14 14:36:53 +02:00
Sebastiaan van Stijn 2668b11ce4
vendor: google.golang.org/grpc v1.66.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b6d27ff60e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-14 13:31:11 +02:00