handleImageToMount was an exact copy of handleBindToMount instead of
populating the ImageOptions.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Previously, multiple suggestions were provided when completing
commands like `run`, `history` and `push`. This change
limits completion to a single suggestion for the above and 2 suggestions for `tag`
Signed-off-by: Mohammed Aminu Futa <mohammedfuta2000@gmail.com>
- Add exported functions to preserve pkg/flag compatibility
- Add IPNetSlice and unit tests
- Revert the local fork added in 80a2256478,
which was pending the upstream feature to be shipped in a release.
full diff: https://github.com/spf13/pflag/compare/v1.0.5...v1.0.6
Revert "Swarm init: use local IPNetSliceValue"
This reverts commit 80a2256478.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Passing the context to the constructor, but explicitly making it
non-cancelable and add a comment describing why context-cancelation
should not be propagated.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Without breaking API compatibility, this patch allows us to know whether
a returned `cli/StatusError` was caused by a context cancellation or
not, which we can use to provide a nicer UX and not print the Go
"context canceled" error message if this is the cause.
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
Users have trouble understanding the different login paths on the CLI.
The default login is performed through an OAuth flow with the option to
fallback to a username and PAT login using the docker login -u <username>
option.
This patch improves the text around docker login, indicating:
- The username is shown when already authenticated
- Steps the user can take to switch user accounts are printed when
authenticated in an info.
- When not authenticated, the OAuth login flow explains the fallback
clearly to the user in an info.
- The password prompt now explicitly states that it accepts a PAT in an
info.
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
- Use stdlib multi-errors instead of creating our own
- use apiClient instead of client for the API client to
prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
- rewrite runServiceScale to return warnings, instead of printing them
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- Use stdlib multi-errors instead of creating our own
- use apiClient instead of client for the API client to
prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
- rename runSecretRemove to runRemove to align with other commands
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- pass through the manifest-store, instead of the CLI as a whole
- handle context cancellation
- rename `runRm` to `runRemove` to align with other commands
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Use stdlib multi-errors instead of creating our own; also
touch-up one error and some minor cleanups.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- use apiClient instead of client for the API client to
prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- use apiClient instead of client for the API client to
prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- use apiClient instead of client for the API client to
prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Tasks with a service filter will result in the daemon performing a lookup
of the full service ID, then updating the provided filter with the actual
ID: 96ded2a1ba/daemon/cluster/tasks.go (L15-L30)
The `getService()` helper has a fast-path for situations where the given
filter is a full ID, before falling back to fuzzy-logic to search filters
by service name or prefix, which would return an error if the result is
ambiguous;
96ded2a1ba/daemon/cluster/helpers.go (L62-L81)
The loop executed here calls `client.ServiceInspectWithRaw()` to get info
of the service, and that method is ultimately calling the exact same
`getService()` helper on the daemon side, which means that we don't need
to repeat the work; we can use the `Service.ID` resolved from that call,
and use it to apply as filter for listing the tasks.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Use intermediate vars, so that the replicatedJobProgressUpdater can
be created in one go intead of setting some fields after the fact.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This check was redundant, because `errors.Join` already checks if the
list of errors is either empty, or only contains `nil` errors, as can
be seen in [this example][1];
package main
import (
"errors"
"testing"
)
func TestMultiErr(t *testing.T) {
var errs []error
if err := errors.Join(errs...); err != nil {
t.Fatal(err)
}
errs = append(errs, nil, nil, nil)
t.Logf("errs contains %d elements", len(errs))
if err := errors.Join(errs...); err != nil {
t.Fatal(err)
}
errs = append(errs, errors.New("with an error"))
if err := errors.Join(errs...); err == nil {
t.Fatal("expected an error")
}
}
[1]: https://go.dev/play/p/iSuGP81eght
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
commit 71ebbb81ae replaced the use of the
custom "cli.Errors" type for stdlib's errors.Join, however it made a
mistake by calling errors.Join for each error occurred, which "nests"
each error instead of putting each error at the same level.
Thanks to Paweł Gronowski for spotting this on the [pull request][1]
[1]: 71ebbb81ae (r1810257735)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>