Commit Graph

1910 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 211220cbb0
cli/command: ResolveAuthConfig, GetDefaultAuthConfig: take ConfigFile as arg
Both these functions took the whole DockerCLI as argument, but only needed
the ConfigFile. ResolveAuthConfig also had an unused context.Context as
argument.

This patch updates both functions to accept a ConfigFile, and removes the
unused context.Context.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-08 17:35:16 +02:00
Sebastiaan van Stijn 57f0e46de1
cli/command/registry: cleanup login tests
- use consts for fixed values, and rename some for clarity
- remove testAuthErrors map and inline the logic (same as we do for other cases)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-08 17:32:03 +02:00
Sebastiaan van Stijn 84c956a171
cli/command/registry: cleanup search tests
- TestSearchContext: don't use un-keyed structs
- TestSearchContext: don't use CompareMultipleValues as it was not needed
- TestSearchContextDescription: don't use un-keyed structs
- TestSearchContextDescription: don't use CompareMultipleValues as it was not needed
- TestSearchContextWrite: don't use un-keyed structs, and include the
  code-comments into the test-table as names for the tests to give them
  some context.
- TestSearchContextWriteJSON and TestSearchContextWriteJSONField were not
  validating the output format, but validating if the JSON output could
  be marshalled back to a struct. Let's just role them into TestSearchContextWrite.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-08 17:32:03 +02:00
Sebastiaan van Stijn 3d0b14c3e3
vendor: github.com/docker/docker 4b19b2f4babd (25.0-dev)
full diff: dab9ffb252...4b19b2f4ba

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-08 09:41:47 +02:00
Djordje Lukic 8d51f36ca3
login: Add message about using PATs
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-08-03 10:35:04 +02:00
Sebastiaan van Stijn 7a89e897ea
cli/command/container: waitExitOrRemoved: take APIClient as argument
It only needs the API client, not the whole DockerCLI.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-24 09:54:11 +02:00
Sebastiaan van Stijn 0b7c72c3ba
cli/command/container: RunStart: inline variable
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-20 00:03:11 +02:00
Danial ad43df5e86
configfile: Initialize nil AuthConfigs
Initialize AuthConfigs map if it's nil before returning it.
This fixes fileStore.Store nil dereference panic when adding a new key
to the map.

Signed-off-by: Danial Gharib <danial.mail.gh@gmail.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-07-19 15:36:10 +02:00
Sebastiaan van Stijn 298bddcc23
cli/command/container: deprecate NewStartOptions
It's unused in the CLI itself, and does nothing other than
initializing a new, empty StartOptions struct.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-19 14:12:07 +02:00
Sebastiaan van Stijn 223bf80d4b
cli/context/docker: Endpoint.ClientOpts, withHTTPClient: inline variables
Remove some intermediate variables, and inline them.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-15 14:41:25 +02:00
Sebastiaan van Stijn 3469beb80d
replace uses of deprecated api/types that moved to api/types/system
These types were moved to api/types/system:

- types.Info
- types.Commit
- types.PluginsInfo
- types.NetworkAddressPool
- types.Runtime
- types.SecurityOpt
- types/KeyValue
- types.DecodeSecurityOptions()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-07-15 01:20:49 +02:00
Paweł Gronowski fe7afb700f
cli/container: Don't ignore error when parsing volume spec
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-07-12 09:45:55 +02:00
Sebastiaan van Stijn df04aca5d2
Merge pull request #4405 from cpuguy83/health_start_interval
Add support for health start interval
2023-07-07 18:15:10 +02:00
Brian Goff 986879c071 Add flags to container/service for health start interval
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2023-07-06 19:05:34 +00:00
Evan Lezar dad225d1e2 Support CDI devices in --device flag
Signed-off-by: Evan Lezar <elezar@nvidia.com>
2023-07-04 14:52:46 +02:00
Sebastiaan van Stijn dc2eb3bf7c
Merge pull request #4394 from laurazard/fix-flaky-ssh
commandconn: return original error while closing
2023-06-30 19:25:22 +02:00
Laura Brehm d5f564adaa
commandconn: return original error while closing
Changes the `Read` and `Write` error handling
logic to return the original error while closing
the connection. We still skip calling `handleEOF`
if already closing the connection.

Fixes the flaky `TestCloseWhileWriting` and
`TestCloseWhileReading` tests.

Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-06-30 19:15:18 +02:00
Sebastiaan van Stijn 92d7a234dd
docker info: fix condition for printing debug information
The daemon collects this information regardless if "debug" is
enabled. Print the debugging information if either the daemon,
or the client has debug enabled.

We should probably improve this logic and print any of these if
set (but some special rules are needed for file-descriptors, which
may use "-1".

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-30 15:00:31 +02:00
Sebastiaan van Stijn 88f44ec159
cli: SetupRootCommand: remove redundant flags return
The flag-set that was returned is a pointer to the command's Flags(), which
is in itself passed by reference (as it is modified / set up).

This patch removes the flags return, to prevent assuming it's different than
the command's flags.

While SetupRootCommand is exported, a search showed that it's only used internally,
so changing the signature should not be a problem.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-28 16:26:50 +02:00
Sebastiaan van Stijn 3cad05fbf9
cli: move "config" flag to cli/flags/ClientOptions.InstallFlags()
This flag was kept separate from the other flags, because at the time, the
CLI code and Daemon code still used the same codebase, and shared some parts.
This option only applied to the `docker` CLI, and thus was kept separate when
migrating to Cobra in 0452ff5a4d

Now that this code is only used for the CLI (and plugins), we can move this
flag together with the other flags.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-28 16:04:09 +02:00
Sebastiaan van Stijn 27bae1172a
Merge pull request #4366 from thaJeztah/remove_deprecated_context_stubs
cli/command/context: remove deprecated k8s / orchestrator option-stubs
2023-06-28 14:42:18 +02:00
Sebastiaan van Stijn fcaf1def27
Merge pull request #4386 from thaJeztah/tls_const
cli/flags: add EnvEnableTLS const for "DOCKER_TLS"
2023-06-28 14:41:59 +02:00
Sebastiaan van Stijn 697bd4bebf
Merge pull request #4378 from acim/master
rename and update mergo module
2023-06-28 14:17:24 +02:00
Sebastiaan van Stijn e382d43f20
Merge pull request #4384 from thaJeztah/config_sync
cli/config: add synchronisation for configDir (Dir, SetDir)
2023-06-28 14:11:36 +02:00
Sebastiaan van Stijn 1c1329fc7e
cli/flags: add EnvEnableTLS const for "DOCKER_TLS"
Add a const to allow documenting the environment variable in code. The location
of this const is a bit "unfortunate", due to CLI and Client-config to be spread
over the cli/config, cli/config/configfile, and docker/docker/client packages
(some options are for the client, others for the CLI), and some reorganizing
may be useful for easier consumption.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-28 13:56:24 +02:00
Sebastiaan van Stijn 0b3cadb056
cli/config: add EnvOverrideConfigDir const
Add a const for the DOCKER_CONFIG to allow documenting its purpose
in code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-28 13:20:29 +02:00
Sebastiaan van Stijn 13e842a110
cli/config: add synchronisation for configDir (Dir, SetDir)
commit 8a30653ed5 introduced a sync.Once
to allow for the config-directory (and home-dir) to be looked up lazily
instead of in an `init()`.

However, the package-level `configDir` variable can be set through two
separate paths; implicitly (through `config.Dir()`), and explicitly,
through `config.SetDir()`. The existing code had no synchronisation for
this, which could lead to a potential race-condition (code requesting
`config.Dir()` and code setting a custom path through `config.SetDir()`).

This patch adds synchronisation by triggering the `sync.Once` as part of
`config.SetDir()` to prevent it being triggered later (overwriting the
value that was set). It also restores the `resetConfigDir()` utility that
was removed in 379122b033, to allow resetting
the `sync.Once` for this test.

In general, we should get rid of this package-level variable, and store
it as a config on the client (passing the option to locations where its
used instead).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-28 12:58:26 +02:00
Boban Acimovic b32264a1af rename and update mergo module
Signed-off-by: Boban Acimovic <boban.acimovic@gmail.com>
2023-06-26 22:25:52 +02:00
Sebastiaan van Stijn 79ff64f06d
cli/command/context: don't use pkg/homedir in test
I'm considering deprecating the "Key()" utility, as it was only
used in tests.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-26 13:35:42 +02:00
Sebastiaan van Stijn 085d5c2816
Merge pull request #4343 from thaJeztah/cleanup_sprintf
replace some basic uses of fmt.Sprintf(), and minor refactor
2023-06-21 11:49:50 +02:00
Sebastiaan van Stijn c96484a114
Merge pull request #4346 from thaJeztah/build_errors
build: error if Dockerfile name is passed with Dockerfile from stdin
2023-06-21 11:48:12 +02:00
Sebastiaan van Stijn 2133d0446a
cli/command/context: remove deprecated k8s / orchestrator option-stubs
support for kubernetes contexts was deprecated in docker 20.10 through
b639ea8b89, 0793f96394,
and 1d37fb3027, and removed altoghether in
23.0 through 193ede9b12.

This patch removes the remaining stubs for options that were deprecated
and no longer used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-21 11:39:04 +02:00
Sebastiaan van Stijn 3c99d229d9
Merge pull request #4363 from thaJeztah/cleanup_useragent
cli/command: newAPIClientFromEndpoint: use WithUserAgent
2023-06-21 11:38:55 +02:00
Sebastiaan van Stijn 2d06cfcde6
cli/command: newAPIClientFromEndpoint: use WithUserAgent
More things to be done after this, to allow passing a custom user-agent,
but let's start with just using this utility.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-20 15:01:41 +02:00
Sebastiaan van Stijn 8181aa8879
cli/command/context: don't pass CLI if we only need context-store
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-20 13:39:02 +02:00
Sebastiaan van Stijn c2535aa467
build: error if Dockerfile name is passed with Dockerfile from stdin
When passing a Dockerfile through stdin, it's not possible to specify the
name of the Dockerfile (using the `-f` option). When building with BuildKit
enabled, an error is already produced for this case, but the classic builder
silently ignored it.

This patch adds an error for this situation:

    echo -e 'FROM busybox' | DOCKER_BUILDKIT=0 docker build -f some.Dockerfile -
    DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
    BuildKit is currently disabled; enable it by removing the DOCKER_BUILDKIT=0
    environment-variable.

    unable to prepare context: ambiguous Dockerfile source: both stdin and flag correspond to Dockerfiles

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-13 14:03:03 +02:00
Sebastiaan van Stijn 77dd05caad
cli/command/image: remove errStdinConflict
This error was only used in a single location, so no need to define a
package-level variable for this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-13 13:47:56 +02:00
Sebastiaan van Stijn 7d723e2ba7
Merge pull request #4337 from thaJeztah/dont_mutate_configfile
cli/command/container: don't mutate ConfigFile.DetachKeys
2023-06-12 21:37:37 +02:00
Sebastiaan van Stijn d68b361538
cli/compose/convert: convertEnvironment: sort results
All users of this function sorted the results afterwards, so let's
do it as part of the function itself.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-12 19:03:59 +02:00
Sebastiaan van Stijn f4bde68694
replace some basic uses of fmt.Sprintf()
Really tiny gains here, and doesn't significantly impact readability:

    BenchmarkSprintf
    BenchmarkSprintf-10    11528700     91.59 ns/op   32 B/op  1 allocs/op
    BenchmarkConcat
    BenchmarkConcat-10    100000000     11.76 ns/op    0 B/op  0 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-12 19:03:49 +02:00
Sebastiaan van Stijn 9e481e09e0
Merge pull request #4226 from laurazard/fix-connhelper-docker-example
ssh: fix error on commandconn close, add ping and default timeout
2023-06-09 22:56:16 +02:00
Laura Brehm a5ebe2282a
commandconn: don't return error if command closed successfully
---
commandconn: fix race on `Close()`

During normal operation, if a `Read()` or `Write()` call results
in an EOF, we call `onEOF()` to handle the terminating command,
and store it's exit value.

However, if a Read/Write call was blocked while `Close()` is called
the in/out pipes are immediately closed which causes an EOF to be
returned. Here, we shouldn't call `onEOF()`, since the reason why
we got an EOF is because we're already terminating the connection.
This also prevents a race between two calls to the commands `Wait()`,
in the `Close()` call and `onEOF()`

---
Add CLI init timeout to SSH connections

---
connhelper: add 30s ssh default dialer timeout

(same as non-ssh dialer)

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-06-09 11:24:19 +02:00
Sebastiaan van Stijn 2331e4d521
cli/command/container: don't mutate ConfigFile.DetachKeys
This code was introduced in 15aa2a663b,
but from those changes, it appears that overwriting the config value was
merely out of convenience, and that struct being used as an intermediate.

While changing the config here should be mostly ephemeral, and not written
back to the config-file, let's be clear on intent, and not mutatte the config
as part of this code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-08 16:54:41 +02:00
Sebastiaan van Stijn 23e26f40fe
cli/command/container: createContainer(): return container-ID
This function returned the whole response, but we already handled the
warnings included in the response as part of the function. All consumers
of this function only used the container-ID, so let's simplify and return
just that (it's a non-exported func, so we can change the signature again
if we really need it).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-08 16:54:41 +02:00
Sebastiaan van Stijn c2c6fbe23c
cli/command/container: TestCreateContainerImagePullPolicy: use sub-tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-08 16:54:41 +02:00
Sebastiaan van Stijn 0c5adb2e98
cli/command/container: attach: rename var that collided with import
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-08 16:54:22 +02:00
Sebastiaan van Stijn 5251d37481
cli/command: add EnvOverrideContext const for "DOCKER_CONTEXT"
Add a const for the name of the environment-variable we accept, so
that we can document its purpose in code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-02 14:20:53 +02:00
Sebastiaan van Stijn 0692d762ac
cli/command: fix GoDoc referencing wrong const
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-01 21:42:30 +02:00
Sebastiaan van Stijn 4cf04988ae
remove uses of golang.org/x/sys/execabs
the "golang.org/x/sys/execabs" package was introduced to address a security
issue on Windows, and changing the default behavior of os/exec was considered
a breaking change. go1.19 applied the behavior that was previously implemented
in the execabs package;

from the release notes: https://go.dev/doc/go1.19#os-exec-path

> Command and LookPath no longer allow results from a PATH search to be found
> relative to the current directory. This removes a common source of security
> problems but may also break existing programs that depend on using, say,
> exec.Command("prog") to run a binary named prog (or, on Windows, prog.exe)
> in the current directory. See the os/exec package documentation for information
> about how best to update such programs.
>
> On Windows, Command and LookPath now respect the NoDefaultCurrentDirectoryInExePath
> environment variable, making it possible to disable the default implicit search
> of “.” in PATH lookups on Windows systems.

With those changes, we no longer need to use the execabs package, and we can
switch back to os/exec.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-26 02:03:45 +02:00
Sebastiaan van Stijn 1ec68fabe4
cli/command/system: remove aufs from fixtures
The AuFS storage driver was deprecated and has been removed, so let's
update the test-fixtures accordingly.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-19 00:55:31 +02:00
Sebastiaan van Stijn 8794455dc3
Merge pull request #4250 from thaJeztah/tininits
tini nits
2023-05-16 18:13:24 +01:00
Sebastiaan van Stijn 10bade23e1
Merge pull request #4261 from thaJeztah/remove_old_buildtags
remove pre-go1.17 build-tags
2023-05-16 18:12:50 +01:00
Sebastiaan van Stijn 97795bb75f
Merge pull request #4281 from thaJeztah/remove_deprecated_config_warning
cli/config: remove warning for deprecated ~/.dockercfg file
2023-05-16 18:12:26 +01:00
Sebastiaan van Stijn 0f78de7ab0
Merge pull request #4280 from thaJeztah/remove_deprecated_EncodeAuthToBase64
cli/command: remove deprecated EncodeAuthToBase64
2023-05-16 18:12:02 +01:00
Sebastiaan van Stijn 3d9905f3d6
Merge pull request #4279 from thaJeztah/remove_deprecated_stack_stubs
cli/command/stack: remove deprecated RunDeploy, RunPS, RunRemove, GetServices
2023-05-16 18:11:41 +01:00
Sebastiaan van Stijn fecb1b2a46
Merge pull request #4282 from thaJeztah/remove_uses_of_client_IsErrNotFound
replace uses of client.IsErrNotFound for errdefs.IsNotFound
2023-05-16 18:11:14 +01:00
Sebastiaan van Stijn 761d973656
Merge pull request #4262 from thaJeztah/no_lookpath
cli/config/credentials: skip unneeded exec.LookPath()
2023-05-16 18:10:50 +01:00
Sebastiaan van Stijn 935df5a59f
Merge pull request #4257 from thaJeztah/context_rename_receiver
cli/context/docker: rename receiver for Endpoint
2023-05-12 00:06:23 +02:00
Sebastiaan van Stijn 2fc30fd456
replace uses of client.IsErrNotFound for errdefs.IsNotFound
None of the client will return the old error-types, so there's no need
to keep the compatibility code. We can consider deprecating this function
in favor of the errdefs equivalent this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-11 23:09:29 +02:00
Sebastiaan van Stijn 537b88dab9
cli/command: don't use legacy "notfound" error-type in tests
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-11 23:09:12 +02:00
Sebastiaan van Stijn 379122b033
cli/config: remove warning for deprecated ~/.dockercfg file
The `~/.dockercfg` file was replaced by `~/.docker/config.json` in 2015
(github.com/docker/docker/commit/18c9b6c6455f116ae59cde8544413b3d7d294a5e).

Commit b83bc67136 (v23.0.0, but backported to
v20.10) added a warning if no "current" config file was found but a legacy
file was, and if the CLI would fall back to using the deprecated file.

Commit ee218fa89e removed support for the
legacy file, but kept a warning in place if a legacy file was in place,
and now ignored.

This patch removes the warning as well, fully deprecating the legacy
`~/.dockercfg` file.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-10 10:58:10 +02:00
Sebastiaan van Stijn 9b791b4fe9
cli/config: Load: remove outdated FIXME
This FIXME was added in 2013 in c72ff318d3
and it's both unclear which "internal golang config parser" is referred to
here. Given that 10 Years have passed, this will unlikely happen, and doesn't
warrant a FIXME here.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-10 10:33:50 +02:00
Sebastiaan van Stijn ff7111ae21
cli/command: remove deprecated EncodeAuthToBase64
This function was deprecated in b87ed34351,
which is part of the v24.0 release, so we can remove it from master.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-09 22:39:22 +02:00
Sebastiaan van Stijn d3ac801275
cli/command/stack: remove deprecated RunDeploy, RunPS, RunRemove, GetServices
These were deprecated in f08252c10a, which
is part of the v24.0 release, so we can remove these on master.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-09 22:32:21 +02:00
Sebastiaan van Stijn 03752a6ba6
Merge pull request #4260 from dvdksn/docs/host-flag
docs: add description and examples for docker -H
2023-05-08 14:06:35 +02:00
David Karlsson 759fa585cf docs: update description for docker -H flag
Signed-off-by: David Karlsson <david.karlsson@docker.com>
2023-05-07 21:45:55 +02:00
Sebastiaan van Stijn 8fc956ce77
Merge pull request #4244 from thaJeztah/update_engine_next
vendor: github.com/docker/docker github.com/docker/docker v24.0.0-rc.1.0.20230505222407-8d9a40a82034 (v24.0.0-rc.2)
2023-05-06 01:32:38 +02:00
Brian Goff f4201b9302
Merge pull request #4073 from panekj/feat/ssh-socket-path
connhelper: Allow socket path when using SSH
2023-05-05 15:50:18 -07:00
Sebastiaan van Stijn 9f15ba0d13
Merge pull request #4156 from AkihiroSuda/docker-run-annotation
cli/command/container: implement `docker run --annotation`
2023-05-06 00:49:15 +02:00
Sebastiaan van Stijn 4f97f55999
vendor: github.com/docker/docker v24.0.0-rc.1.0.20230505222407-8d9a40a82034
This will be v24.0.0-rc.2

full diff: https://github.com/docker/docker/compare/v24.0.0-rc.1...8d9a40a820349860405e142249c55215aa4da8e3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-06 00:34:34 +02:00
Sebastiaan van Stijn ce11b28d83
cli/config/credentials: skip unneeded exec.LookPath()
defaultCredentialsStore() on Linux does an exec.LookPath() for "pass", but
if a custom credential-store is passed to DetectDefaultStore, the result
of that won't be used.

This patch changes the logic to return early if a custom credential-store
is passed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-05 21:10:18 +02:00
Sebastiaan van Stijn 2ae223038c
remove pre-go1.17 build-tags
Removed pre-go1.17 build-tags with go fix;

    go mod init
    go fix -mod=readonly ./...
    rm go.mod

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-05 18:23:03 +02:00
Sebastiaan van Stijn 1073b0269a
cli/context/docker: rename receiver for Endpoint
Code in methods of this type also used the Client, and having this receiver
named "c" made it easy to confuse it for referring to Client ("c").

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-04 17:08:18 +02:00
Sebastiaan van Stijn 2b7bfb3994
cli/command/image/build: GetContextFromReader: rename var that collided
This var collided with the `archive/tar` import.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-03 17:02:12 +02:00
Sebastiaan van Stijn ab17029c63
cli/command/container: hijackedIOStreamer: explicitly ignore err
Make the linters and IDEs happier

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-03 17:01:08 +02:00
Sebastiaan van Stijn 155f7d9e2b
cli/command/system: add utilities for printing
Adding some utilities to print the output, to keep the linters happier
without having to either suppress errors, or ignore them.

Perhaps we should consider adding utilities for this on the "command.Streams"
outputs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-02 16:55:12 +02:00
Sebastiaan van Stijn 1e89037d72
cli/command/system: prettyInfo: accept Streams
No need to pass whole of DockerCLI, as all it needs is the outputs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-02 16:54:05 +02:00
Sebastiaan van Stijn 8cfefc6ea2
cli/command/system: prettyPrintServerInfo: accept Streams
No need to pass whole of DockerCLI, as all it needs is the outputs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-02 16:51:32 +02:00
Sebastiaan van Stijn ba7a200f0a
cli/command/system: prettyPrintClientInfo: accept Streams
No need to pass whole of DockerCLI, as all it needs is the outputs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-02 16:50:54 +02:00
Sebastiaan van Stijn 73938cd618
cli/command/system: printSwarmInfo(): accept io.Writer
Don't require whole of DockerCLI to be passed, as all we need is a writer.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-02 16:50:29 +02:00
Sebastiaan van Stijn 2d0ea86b0a
cli/command/system: use io.Writer for printing warnings
Don't require whole of DockerCLI to be passed, as all we need is a writer.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-02 16:17:00 +02:00
Sebastiaan van Stijn be6f4cd56c
cli/command/system: prettyPrintServerInfo: refactor printing "runtimes"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-02 16:05:52 +02:00
Sebastiaan van Stijn 1d70f7cdb4
cli/command/system: prettyPrintServerInfo: rename var that collided with import
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-02 16:01:46 +02:00
Sebastiaan van Stijn 416e55bedb
github.com/docker/cli/cli/command/system: add BenchmarkPrettyPrintInfo
goos: linux
    goarch: arm64
    pkg: github.com/docker/cli/cli/command/system
    BenchmarkPrettyPrintInfo
    BenchmarkPrettyPrintInfo-5   	  189028	      6156 ns/op	    1776 B/op	      88 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-02 15:49:16 +02:00
Sebastiaan van Stijn bd2c26328f
vendor: github.com/docker/docker v24.0.0-rc.1
full diff: https://github.com/docker/docker/compare/v24.0.0-beta.2...v24.0.0-rc.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-28 17:56:17 +02:00
Sebastiaan van Stijn f02301ab5d
remove uses of deprecated VirtualSize field
The VirtualSize field is deprecated and the upcoming API version v1.44
will no longer propagate the field. See:
1261fe69a3,

Given that in docker 1.10 and up (API v1.22), the VirtualSize and Size
fields contain the same value, and the "df" endpoint was not supported
until API v1.25, we can "safely" use Size instead; see:

- 4ae7176ffb
- 4352da7803

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-28 14:58:53 +02:00
Sebastiaan van Stijn 59b07b7253
Merge pull request #4045 from vvoland/test-e2e-arm64-fixes
test/e2e: Fix running `test-e2e` on non-amd64 platforms
2023-04-27 11:41:43 +02:00
Paweł Gronowski ec5504a83f
test/e2e: Use "frozen" tag to reference test images
This makes it possible to update the image loaded for e2e tests without
modifying all tests that use them.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-27 10:57:57 +02:00
Sebastiaan van Stijn 019657a986
Merge pull request #4174 from thaJeztah/remove_deprecated_streams
cli/command: remove deprecated Stream types
2023-04-26 13:10:21 +02:00
Sebastiaan van Stijn 04bf047a2c
Merge pull request #4205 from thaJeztah/info_dont_depend_on_IndexServerAddress
cli/command/system: prettyPrintServerInfo: don't depend on IndexServerAddress and credential-store
2023-04-26 13:07:01 +02:00
Sebastiaan van Stijn c180202cea
cli/command: remove deprecated Stream types
These were deprecated in eb0ba4f8d5, which
was part of docker 19.03, so users should have had a chance to migrate.

This removes InStream, OutStream, NewInStream and NewOutStream

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-25 11:07:45 +02:00
Sebastiaan van Stijn 0dec5d20a2
volumes: prune: add --all / -a option
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-20 23:31:47 +02:00
Sebastiaan van Stijn d4f2609ce8
Merge pull request #4216 from vvoland/buildkit-empty
Handle empty DOCKER_BUILDKIT like unset
2023-04-19 20:28:36 +02:00
Paweł Gronowski ff7f76af7a
Handle empty DOCKER_BUILDKIT like unset
This fixes the cli erroring out if the variable is set to an empty
value.

```
$ export DOCKER_BUILDKIT=
$ docker version
DOCKER_BUILDKIT environment variable expects boolean value: strconv.ParseBool: parsing "": invalid syntax
```

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-19 14:17:01 +02:00
Laura Brehm 271b9667ee
Swarm: allow additional properties in `build`
Since Swarm does not use the `build` section, there's no reason to validate properties here.
This makes it so we don't have to keep updating the schema in the CLI to support properties
added in the Compose Spec for build, and does not imply any new feature support since Swarm
does not consider this section.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-04-18 14:51:49 +01:00
Laura Brehm e2bfd21991
cli/compose: add schema 3.11 (no changes with 3.10 yet)
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-04-18 14:51:27 +01:00
Akihiro Suda 88be16cb5b
cli/command/container: implement `docker run --annotation`
For moby/moby PR 45025 (Docker v24, API v1.43).

`docker run --annotation foo=bar` is similar to `podman run --annotation foo=bar`,
however, unlike Podman, Docker implementation also accepts an annotation with an empty value.
(`docker run --annotation foo`)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-04-14 12:59:12 +09:00
Sebastiaan van Stijn da3871fd8e
cli/command/system: printServerWarnings: use client API version from info
Set the client's API version that's used in the info, instead of requesting
it as part of printing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-14 00:49:49 +02:00
Sebastiaan van Stijn be307c5792
cli/command/system: prettyPrintServerInfo: move out collecting username
Make this function only _print_ the info we have, and not read the username
from the credential-store.

This patch adds a Username field to the (local) `info` type, and sets it
when needed, so that prettyPrintServerInfo only has to format and print
the information, instead of calling out to the credential-store.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-14 00:25:08 +02:00
Sebastiaan van Stijn 71fde20e17
cli/command/system: prettyPrintServerInfo: simplify username
Starting with b4ca1c7368, docker login
no longer depends on info.IndexServerAddress to determine the default
registry.

The prettyPrintServerInfo() still depended on this information, which
could potentially show the wrong information.

This patch changes it to also depend on the same information as docker login
now does.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-14 00:22:47 +02:00