Compare commits

...

285 Commits

Author SHA1 Message Date
dd360c7c0d Merge pull request #2558 from tiborvass/19.03-expenv-panic
[19.03] Fix bug with panic when DOCKER_CLI_EXPERIMENTAL environment variable is incorrect
2020-05-28 13:41:25 -07:00
92b54c256a Merge pull request #2560 from tiborvass/19.03-sshfix
[19.03] ssh: avoid setting flags through hostname
2020-05-28 13:34:20 -07:00
2ee7981985 ssh: avoid setting flags through hostname
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit d30970e3b1)
Signed-off-by: Tibor Vass <tibor@docker.com>
2020-05-28 20:18:03 +00:00
e90b6bcb62 Fix bug with panic when DOCKER_CLI_EXPERIMENTAL environment variable is incorrect
Signed-off-by: Daniil Nikolenko <qoo2p5@gmail.com>
(cherry picked from commit cb010db830)
Signed-off-by: Tibor Vass <tibor@docker.com>
2020-05-28 19:21:44 +00:00
fd7874f16d Merge pull request #2532 from thaJeztah/19.03_backport_bump_golang_1.13.11
[19.03 backport] Bump Golang 1.13.11
2020-05-20 10:43:45 -07:00
a945f0e7e0 Merge pull request #2538 from silvin-lubecki/fix-version-old-engine-19-03
[19.03 backport] Fix version old engine 19 03
2020-05-20 10:35:44 -07:00
0f59532a1a Run e2e tests with different engine version on Jenkins
Rewrite Jenkinsfile to new declarative syntax without parallel as the e2e framework is not tailored for than (container name clash, port clash,...)

Signed-off-by: Tibor Vass <tibor@docker.com>
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>

(cherry picked from commit 74919d0569)
2020-05-20 19:02:21 +02:00
95df3499bb Add a new Makefile variable to override DockerInDocker engine version we use to run e2e tests
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 15d6565e49)
2020-05-20 18:58:28 +02:00
2d1476c6f0 Partially revert cf663b526a as it breaks the version negotiation with an older docker engine.
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 54f766d240)
2020-05-20 18:57:39 +02:00
936e9717ea Bump Golang 1.13.11
full diff: https://github.com/golang/go/compare/go1.13.10...go1.13.11

go1.13.11 (released 2020/05/14) includes fixes to the compiler. See the Go 1.13.11
milestone on the issue tracker for details:

https://github.com/golang/go/issues?q=milestone%3AGo1.13.11+label%3ACherryPickApproved

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 1ecca982ed)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-18 16:00:26 +02:00
ab108430b2 Merge pull request #2520 from thaJeztah/19.03_backport_markup_touch_ups
[19.03 backport] docs: more Markdown touch-ups
2020-05-11 19:24:50 +02:00
489c7e9cda docs: more Markdown touch-ups
- replace the "none" code-hint with "console"
- some changes in the "experimental" instructions
- reformat some notes
- reformat / re-indent JSON output to use 2 spaces (for consistency)
- split JSON outputs to separate code-block so that it can be highlighted

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 4d948e468b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-11 17:57:13 +02:00
1705e47cdf Merge pull request #2508 from thaJeztah/19.03_backport_config_dont_init
[19.03 backport] config: don't call homedir on init()
2020-05-11 16:27:11 +02:00
a9a83d2e71 Merge pull request #2516 from thaJeztah/19.03_backport_bump_klog
[19.03 backport] vendor: k8s.io/klog v1.0.0-2-g4ad0115
2020-05-11 15:58:09 +02:00
ae2012cced Merge pull request #2518 from thaJeztah/19.03_backport_bump_pkg_errors
[19.03 backport] vendor: pkg/errors v0.9.1
2020-05-11 15:36:22 +02:00
052a71c4d0 Merge pull request #2509 from thaJeztah/19.03_backport_docs_fixes
[19.03 backport] documentation fixes
2020-05-11 14:40:18 +02:00
9a57ea8869 Update some uses of errors.Cause() to errors.Is()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit bb7ef2cb3a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-11 14:39:24 +02:00
345b0e79e5 vendor: pkg/errors v0.9.1
full diff: https://github.com/pkg/errors/compare/v0.8.1...v0.9.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 082a8bd892)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-11 14:39:15 +02:00
62a9babca6 vendor: k8s.io/klog v1.0.0-2-g4ad0115
Temporarily vendoring tip of the release-1.x branch, to address
docker context inspect being slow on Windows because this package
performs user lookup through `os.Current()` during `init()`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 466c50f939)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-10 14:25:33 +02:00
dbc73eafcb docs: fix, and touch-up "docker context" docs
Using `/var/run/docker.sock` as docker host is invalid, and causes
an error, so adding `unix://` to it.

In addition, we document the name of the context to go after the
options, so change the order in the examples.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 803b9071e7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-09 12:51:36 +02:00
e06fc01c1b Update dead link and add missing info on COPY
1. Fix dead URL to [Dockerfile best practices](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#leverage-build-cache).
2. Add missing information about cache invalidation by `COPY`. It works in the same way as in the case of `ADD`. Informing only about the `ADD`s behavior is misleading as one can infer that these two directives differ in this regard.
3. Add missing info on RUN cache invalidation by COPY

Signed-off-by: Maciej Kalisz <maciej.d.kalisz@gmail.com>
(cherry picked from commit ef414633d6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-09 12:51:09 +02:00
8434242c74 config: don't call homedir on init()
This patch changes the package to lazily obtain the user's home-
directory on first use, instead of when initializing the package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8a30653ed5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-09 12:47:39 +02:00
bef0d567ac Merge pull request #2493 from thaJeztah/19.03_backport_update_dockerd_usage
[19.03 backport] docs: update usage output for dockerd (19.03)
2020-05-04 16:17:28 +02:00
65c37227a9 docs: update usage output for dockerd (19.03)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d096339f41)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-04 13:02:31 +02:00
55a5ab0f0a docs: fix order of flags in usage, and fix missing quote
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9a58504d33)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-04 12:53:20 +02:00
a2d8a8a4cb Merge pull request #2484 from thaJeztah/19.03_backport_fix_builder_link
[19.03 backport] builder: fix broken link
2020-04-30 14:47:08 -07:00
c150ba2b85 builder: fix broken link
This link was broken when generating the documentation (due to
a bug in Jekyll not converting wrapped internal links)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit bc58d655c0)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-30 21:48:14 +02:00
3929933368 Merge pull request #2457 from thaJeztah/19.03_backport_lazy_feature_detection
[19.03 backport] cli: perform feature detection lazily
2020-04-30 17:43:14 +02:00
62baa3ce57 Merge pull request #2471 from thaJeztah/19.03_backport_fix_bind_panic
[19.03 backport] fix panic on single-character volumes
2020-04-30 17:31:35 +02:00
7a2de8165b Merge pull request #2470 from thaJeztah/19.03_backport_bump_yaml
[19.03 backport] vendor: bump gopkg.in/yaml.v2 v2.2.8
2020-04-30 17:22:21 +02:00
0ea509c77c Merge pull request #2481 from thaJeztah/19.03_backport_fix_run_reference_links
[19.03 backport] docs: fix links, and minor markdown touch-ups
2020-04-30 01:09:58 +02:00
81909d70f0 docs: fix links, and minor markdown touch-ups
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 116c9a1f59)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-30 00:19:48 +02:00
cf663b526a cli: perform feature detection lazily
- Perform feature detection when actually needed, instead of during
  initializing
- Version negotiation is performed either when making an API request,
  or when (e.g.) running `docker help` (to hide unsupported features)
- Use a 2 second timeout when 'pinging' the daemon; this should be
  sufficient for most cases, and when feature detection failed, the
  daemon will still perform validation (and produce an error if needed)
- context.WithTimeout doesn't currently work with ssh connections (connhelper),
  so we're only applying this timeout for tcp:// connections, otherwise
  keep the old behavior.

Before this change:

    time sh -c 'DOCKER_HOST=tcp://42.42.42.41:4242 docker help &> /dev/null'
    real   0m32.919s
    user   0m0.370s
    sys    0m0.227s

    time sh -c 'DOCKER_HOST=tcp://42.42.42.41:4242 docker context ls &> /dev/null'
    real   0m32.072s
    user   0m0.029s
    sys    0m0.023s

After this change:

    time sh -c 'DOCKER_HOST=tcp://42.42.42.41:4242 docker help &> /dev/null'
    real   0m 2.28s
    user   0m 0.03s
    sys    0m 0.03s

    time sh -c 'DOCKER_HOST=tcp://42.42.42.41:4242 docker context ls &> /dev/null'
    real   0m 0.13s
    user   0m 0.02s
    sys    0m 0.02s

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b39739123b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-29 17:12:23 +02:00
c44c18e088 docker build: check experimental --platform on pre-run
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a88a1bea23)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-29 17:12:21 +02:00
25f04876d1 app-214 Load Client info in getter function
Signed-off-by: Anca Iordache <anca.iordache@docker.com>

Possible approach for client info

- split ClientInfo() into ClientInfo() and loadClientInfo()
- split ConfigFile() into ConfigFile() and loadConfigFile()
- ConfigFile() and ClientInfo() call their corresponding loadXX function
  if it has not yet been loaded; this allows them to be used before
  Initialize() was called.
- Initialize() *always* (re-)loads the configuration; this makes sure
  that the correct configuration is used when actually calling commands.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 22a5dad847)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-29 17:12:18 +02:00
e470eef36f Merge pull request #2469 from thaJeztah/19.03_backport_docs
[19.03 backport] assorted docs fixes
2020-04-28 12:02:54 +02:00
4ad65fc358 fix panic on single-character volumes
Before this change, this would cause a panic:

    docker run -it --rm -v 1:/1 alpine
    panic: runtime error: index out of range

    goroutine 1 [running]:
    github.com/docker/cli/cli/compose/loader.isFilePath(0xc42027e058, 0x1, 0x557dcb978c20)
    ...

After this change, a correct error is returned:

    docker run -it --rm -v 1:/1 alpine
    docker: Error response from daemon: create 1: volume name is too short, names should be at least two alphanumeric characters.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 11869fa42a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-28 11:58:25 +02:00
83d4cb9000 vendor: bump gopkg.in/yaml.v2 v2.2.8
full diff: https://github.com/go-yaml/yaml/compare/v2.2.3...v2.2.8

includes:

- go-yaml/yaml 515 Improve heuristics preventing CPU/memory abuse
- go-yaml/yaml@f90ceb4f40 Fix check for non-map alias merging in v2
    - fix for "yaml.Unmarshal crashes on "assignment to entry in nil map""
- go-yaml/yaml 543 Port stale simple_keys fix to v2
- go-yaml/yaml@1f64d6156d Fix issue in simple_keys improvements
    - fixes "Invalid simple_keys now cause panics later in decode"
- go-yaml/yaml 555 Optimize cases with long potential simple_keys

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3dfcfbb2bf)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-28 11:55:26 +02:00
0cfe29431c service update: fix service create example
Service create expects the name to be passed using the
`--name` flag, not as a positional parameter

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 0cd7c6aa02)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-28 11:47:37 +02:00
2dc593f67f Add container_iface_prefix option to documentation
Signed-off-by: dominikbraun <braun@sternentstehung.de>
(cherry picked from commit 84a07a9977)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-28 11:47:16 +02:00
d25e657341 Merge pull request #2445 from thaJeztah/19.03_backport_network_prune_improve_message
[19.03 backport] improve "network prune" output to mention custom networks only
2020-04-21 17:23:18 +02:00
8986e31201 Merge pull request #2456 from thaJeztah/19.03_backport_gotest_v3
[19.03 backport] bump gotest.tools v3.0.1 for compatibility with Go 1.14
2020-04-21 17:06:56 +02:00
4fe6b837b7 bump gotest.tools v3.0.1 for compatibility with Go 1.14
full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2c0e93063b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-21 16:43:18 +02:00
a8454a4d92 update vndr v0.1.1
full diff: https://github.com/LK4D4/vndr/compare/v0.1.0...v0.1.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7c54406951)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-20 22:51:22 +02:00
950dcedd97 bump vndr v0.1.0 to support versioned import paths
With this change, go packages/modules that use versioned
import paths (github.com/foo/bar/v2), but don't use a directory
in the repository, can now be supported.

For example:

```
github.com/coreos/go-systemd/v22 v22.0.0
```

will vendor the github.com/coreos/go-systemd repository
into `vendor/github.com/coreos/go-systemd/v22`.

full diff: b177b583eb...v0.1.0

- LK4D4/vndr#79 Add more clear messages around clone failures
- LK4D4/vndr#80 add riscv64 support
- LK4D4/vndr#83 migrate bitbucket to api 2.0
    - fixes LK4D4/vndr#82 https://api.bitbucket.org/1.0/repositories/ww/goautoneg: 410 Gone
- LK4D4/vndr#86 Replace sort.Sort with sort.Strings
- LK4D4/vndr#87 support `github.com/coreos/go-systemd/v22`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7904c23df8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-20 22:51:20 +02:00
05ad944d13 Merge pull request #2453 from thaJeztah/19.03_backport_fixup_markdown_and_links
[19.03 backport] documentation changes
2020-04-20 14:01:29 +02:00
0d26cbf5b7 yamldocs: add description to base command
Currently the documentation uses a special case for this command,
so adding a description to the YAML in order to remove that
special case.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c4798a9daa)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-19 19:53:33 +02:00
d4e4fa3b46 experimental/vlan-networks: markdown touch-ups
- wrap to 80-chars
- reformat notes
- add code-hints to help highlighting

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 86257b0fc7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-19 19:43:09 +02:00
de12dbfb16 docs/reference: explain "colon"
Colon may not be something non-native English readers
know about, so explain the symbol in the running text.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e34c407516)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-19 19:42:57 +02:00
7ae77e51f2 docs/extend: reformat notes
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e4fc8cfa23)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-19 19:42:49 +02:00
733ae82dae docs/builder: touch up markdown, and some minor rephrasing
- add code-fences with code-hints so that the right hightlighting is applied
- replace `*` for `-` in bullet-lists for consistency with other parts of the
  documentation.
- reduced number of "notes", either by combining some, or by changing some
  to regular text.
- removed "line numbers" from some examples, because there's only four lines,
  which should not need really need line numbers.
- reformat some notes to our new format

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 16730a2ab6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-19 19:42:38 +02:00
9a1ba7d39a docs/reference/run.md: touch-up markdown
- add code-fences with code-hints so that the right
  hightlighting is applied
- reduced number of "notes", either by combining some,
  or by changing some to regular text.
- use tables for some option lists

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b73df4a231)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-19 19:41:54 +02:00
6ba9a3e4c9 reference docs: reformat notes
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6ae5df423a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-19 19:41:52 +02:00
96eb0888fa reference docs: fix broken links and markdown touch-ups
- fix various broken links
- fix incorrect anchors
- updated links for content that moved, so that no
  redirect to the new location is needed.
- touched-up Markdown;
  - re-format some JSON output
  - add blank line betweeen command and command output
  - format "note" blocks

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8919c228bd)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-19 19:41:50 +02:00
2676c603fb Adding missing title in builder.md
addresses https://github.com/docker/docker.github.io/issues/9691

Signed-off-by: hsam <hfsam88@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7557c138d7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-19 19:41:48 +02:00
365bae4f89 Add clarification when using USER UID:GI
Signed-off-by: Michael Irwin <mikesir87@gmail.com>
(cherry picked from commit b3a1681fd8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-19 19:41:45 +02:00
04533bd523 Merge pull request #2442 from thaJeztah/19.03_backport_update_go_events
[19.03 backport] vendor: update go-events to fix alignment for 32bit systems
2020-04-15 10:55:12 +02:00
c38b260077 improve "network prune" output to mention custom networks only
The `docker network prune` command removes unused custom networks,
but built-in networks won't be removed. This patch updates the
message to mention that it's only removing custom networks.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit eb93a865ed)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-15 10:54:57 +02:00
ba0a2ffe2a Merge pull request #2444 from thaJeztah/19.03_backport_host_gateway_validation
[19.03 backport] Skip IPAddr validation for "host-gateway" string
2020-04-15 10:53:02 +02:00
fd9eedce3c Add "host-gateway" to tests for extra_hosts / --add-host
67ebcd6dcf added an exception for
the "host-gateway" magic value to the validation rules, but didn't
add thise value to any of the tests.

This patch adds the magic value to tests, to verify the validation
is skipped for this magic value.

Note that validation on the client side is "optional" and mostly
done to provide a more user-friendly error message for regular
values (IP-addresses).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f88ae74135)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-15 09:53:37 +02:00
3651189826 Skip IPAddr validation for "host-gateway" string
Relates to - moby/moby 40007
The above PR added support in moby, that detects if
a special string "host-gateway" is added to the IP
section of --add-host, and if true, replaces it with
a special IP value (value of --host-gateway-ip Daemon flag
which defaults to the IP of the default bridge).

This PR is needed to skip the validation for the above
feature

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 67ebcd6dcf)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-15 09:36:14 +02:00
a0f0ed1f5f vendor: update go-events to fix alignment for 32bit systems
- relates to moby/buildkit 1111
- relates to moby/buildkit 1079
- relates to docker/buildx 129

full diff: 9461782956...e31b211e4f

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 5661cc0de5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-14 13:53:44 +02:00
173c85ad75 Merge pull request #2431 from thaJeztah/19.03_backport_bump_golang_1.13.10
[19.03 backport] Bump Golang 1.13.10
2020-04-10 23:55:43 +02:00
de6a5fa447 Bump Golang 1.13.10
go1.13.10 (released 2020/04/08) includes fixes to the go command, the runtime,
os/exec, and time packages. See the Go 1.13.10 milestone on the issue tracker
for details:

https://github.com/golang/go/issues?q=milestone%3AGo1.13.10+label%3ACherryPickApproved

full diff: https://github.com/golang/go/compare/go1.13.9...go1.13.10

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6875390131)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-10 22:37:09 +02:00
1a4749b8e7 Merge pull request #2435 from thaJeztah/19.03_backport_bump_certificates
[19.03 backport] CI: update notary test certificates
2020-04-10 12:59:09 -07:00
19ccd4f5d4 CI: update notary test certificates
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6bd09229a5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-10 16:44:18 +02:00
d7f5f70c39 Merge pull request #2419 from thaJeztah/19.03_backport_bump_golang_1.13.9
[19.03 backport] Bump Golang 1.13.9
2020-04-06 16:20:22 +02:00
f8fc68f174 Bump Golang 1.13.9
go1.13.9 (released 2020/03/19) includes fixes to the go command, tools, the
runtime, the toolchain, and the crypto/cypher package. See the Go 1.13.9
milestone on the issue tracker for details:

https://github.com/golang/go/issues?q=milestone%3AGo1.13.9+label%3ACherryPickApproved

full diff: https://github.com/golang/go/compare/go1.13.8...go1.13.9

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d063b835b3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-06 16:02:03 +02:00
7d48500057 Merge pull request #2403 from thaJeztah/19.03_backport_update_deprecation_policy
[19.03 backport] Update deprecation policy to 1 stable release
2020-03-20 16:22:40 +01:00
22cbf91618 Update deprecation policy to 1 stable release
The deprecation policy was written when we had monthly releases
(edge+stable), and stable releases were released every 3 months.

The release cadence has changed to be longer than 3 months for
stable releases, so adjusting the policy accordingly.

Note that the policy continues to be "at least x releases", so
even though we _can_ remove a feature after one release, it does
not mean we _must_ remove it: announcing deprecations early helps
users migrate away from features we do not intent to support in
future.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 94f513e48e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-20 13:07:39 +01:00
0b0ea3f0fa Merge pull request #2401 from thaJeztah/19.03_backport_deprecation_policy
[19.03 backport] Include deprecation policy on deprecated features page
2020-03-20 11:50:53 +01:00
288cdec291 Include deprecation policy on deprecated features page
This section was included on a page on docs.docker.com, but not linked
in the navigation. Putting the section on the deprecated features page
to be sure they can be found together.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 99443274b1)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-20 11:04:34 +01:00
a4d902af53 Merge pull request #2399 from thaJeztah/19.03_backport_remove_comments
[19.03 backport] remove unneeded comment from reference files
2020-03-19 20:09:48 +01:00
ffffc1ed49 remove unneeded comment from reference files
these markdown files are not consumed directly in the docs,
but only their content is included through the YAML does,
so there's no need to have these comments in them

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f30bde6adb)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-19 15:26:30 +01:00
bf1f5fcfb3 Merge pull request #2393 from thaJeztah/19.03_backport_codehints_compatibility
[19.03 backport] docs: update code-hints for compatibility with "rouge"
2020-03-17 16:52:40 +01:00
c35400655d Merge pull request #2391 from thaJeztah/19.03_backport_fix_yamldocs
[19.03 backport] Fix yamldocs generator to accomodate nested subcommands
2020-03-17 16:50:45 +01:00
9fd323afdc Fix whitespace that caused short-format in generated YAML
If the markdown contains trailing spaces, or has tabs included,
the YAML generator uses a compact format for the text (using `\n`
and `\t`, instead of plain newlines).

The compact format makes it difficult to review changes in the
yaml docs when vendoring in the documentation repository.

This patch:

- removes trailing whitespace
- replaces tabs for spaces
- fixes some minor formatting and markdown issues

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f912deeec7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-17 16:42:19 +01:00
c936ea9693 Fix yamldocs generator to accomodate nested subcommands
The script was written to only take subcommands at the first and second level
into account, but failed to find the Markdown files for extended descriptions of
subcommands at the third level, such as `docker trust key generate`, and
`docker trust key load`:

    WARN: /go/src/github.com/docker/cli/docs/reference/commandline/key_generate.md does not exist, skipping
    WARN: /go/src/github.com/docker/cli/docs/reference/commandline/key_load.md does not exist, skipping
    WARN: /go/src/github.com/docker/cli/docs/reference/commandline/signer_add.md does not exist, skipping
    WARN: /go/src/github.com/docker/cli/docs/reference/commandline/signer_remove.md does not exist, skipping

This patch updates the script to accomodate subcommands that are more deeply
nested. While at it, some minor cleaning and linting issues were also addressed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e1b362847f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-17 16:42:17 +01:00
d484456c29 Fix naming of reference docs files
These files were intended to document the `swarm join-token` and
`swarm unlock-key` subcommands, but were incorrectly using an underscore
instead of a hyphen (`-`). As a result, the examples were not picked up
by the yamldocs generator.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 5115bfa041)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-17 16:42:15 +01:00
6a02465f4c docs: update code-hints for compatibility with "rouge"
Unlike GitHub's web-UI, the "rouge" hightlighter used in our
online documentation is case-sensitive. As a result, code-blocks
having the Dockerfile (uppercase) code-hint were not highlighted.

This changes those to use lowercase, which is supported by both.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 824a9ce64b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-17 15:04:51 +01:00
f53663a951 Merge pull request #2364 from thaJeztah/19.03_backport_bump_golang_1.13
[19.03 backport] Update Golang 1.13.8
2020-03-12 18:00:04 +01:00
eb310fca49 Merge pull request #2373 from tiborvass/19.03-bump-grpc-1.23.1
[19.03 backport] Bump grpc to v1.23.1
2020-03-03 22:59:52 +01:00
0e40b91921 vendor: bump google.golang.org/grpc v1.23.1
full diff: https://github.com/grpc/grpc-go/compare/v1.23.0...v1.23.1

- grpc/grpc-go#3018 server: set and advertise max frame size of 16KB
- grpc/grpc-go#3017 grpclb: fix deadlock in grpclb connection cache
    - Before the fix, if the timer to remove a SubConn fires at the
      same time NewSubConn cancels the timer, it caused a mutex leak
      and deadlock.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 013151ff78)
Signed-off-by: Tibor Vass <tibor@docker.com>
2020-03-03 21:39:18 +00:00
a51e9e6397 vendor: update grpc to v1.23.0
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 70a4eb2a49)
Signed-off-by: Tibor Vass <tibor@docker.com>
2020-03-03 21:39:13 +00:00
6e07d210a4 Update Golang 1.13.8
Also pinning the e2e image to the "buster" variant,
which is what's currently used, but making it explicit.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 4313c8b3c6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-27 17:52:57 +01:00
3ff19c3755 Merge pull request #2352 from thaJeztah/19.03_backport_add_daemon_redirect
[19.03 backport] docs: add redirect for old location of daemon reference
2020-02-26 17:18:59 +01:00
e94a87225a docs: add redirect for old location of daemon reference
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 4cd4305b31)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-26 16:35:08 +01:00
7c803f7c34 Merge pull request #2344 from thaJeztah/19.03_backport_builder_prune_flags
[19.03 backport] fix builder prune flag descriptions
2020-02-26 16:32:45 +01:00
4591b13318 Merge pull request #2342 from thaJeztah/19.03_backport_bump_golang_1.12.17
[19.03 backport] Update Golang 1.12.17
2020-02-19 11:48:11 +01:00
f9a5c1f152 Fix builder prune -a/--all flag description
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit aad9d2c958)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-18 14:33:42 +01:00
829843333b unused-for is a deprecated synonym
See 9e7d5ac5ea/builder/builder-next/builder.go (L574)

Signed-off-by: Samuel Cochran <sj26@sj26.com>
(cherry picked from commit 758d12e651)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-18 14:33:28 +01:00
f0e74408cf Update Golang 1.12.17
full diff: https://github.com/golang/go/compare/go1.12.16...go1.12.17

go1.12.17 (released 2020/02/12) includes a fix to the runtime. See the Go 1.12.17
milestone on the issue tracker for details:

https://github.com/golang/go/issues?q=milestone%3AGo1.12.17+label%3ACherryPickApproved

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 5e5ef9e0b9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-17 14:58:54 +01:00
a4bedce165 Merge pull request #2320 from thaJeztah/19.03_docs_backports
[19.03 backport] assorted documentation updates
2020-02-10 17:20:36 +01:00
d4755cfbd5 docs: update deprecated status for --disable-legacy-registry
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 73c9a44d58)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 16:55:02 +01:00
6eef644faf docs: add status table to "deprecated.md"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d4c0de2719)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 16:32:37 +01:00
f47f8e333b docs: mark deprecation of "docker engine" subcommands
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e8c2dba697)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 16:32:36 +01:00
64838b6907 docs: mark deprecation of "dab" files and top-level "deploy" subcommand
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c7aca08497)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 16:32:33 +01:00
c8308ecf6c docs: sort "deprecated.md" by deprecation release
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b6875ad690)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 16:32:31 +01:00
793c75015e docs: update some release-versions in "deprecated.md"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 672c00e1cc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 16:32:29 +01:00
776e181628 docs: minor touch-ups in "deprecated.md"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c3092d9408)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 16:32:27 +01:00
7fac7eb1af docs: service create: document os/arch constraints and more examples
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f26e9a3a61)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 16:31:41 +01:00
27f0612665 docs: service create: document non-matching/exclude constraints
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b059c93c92)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 16:31:39 +01:00
d5ce81172f docs: service create: use markdown table for constraints
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit abeb7babdf)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 16:31:36 +01:00
3a1d0c67ff Give an example for --reserve-memory
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 76852f82ba)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 16:30:55 +01:00
e1c31c8910 Merge pull request #2315 from thaJeztah/19.03_backport_carry_855_config_opts
[19.03 backport] Add examples for configs
2020-02-10 12:01:37 +01:00
2d6231ad4d Remove a useless '\' and enhance a script in an example in the section 'Add entries ... (--add-host)'
Signed-off-by: Abreto FU <public@abreto.email>
(cherry picked from commit 07436dfe78)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 10:41:32 +01:00
be60297514 Add examples for configs
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 473a9d20cd)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-10 10:38:58 +01:00
528b959ebc Merge pull request #2311 from thaJeztah/19.03_backport_carry_1889_build_docs_update
[19.03 backport] documentation updates
2020-02-06 17:16:35 +01:00
b668f31022 Syntax corrected
Below are the changes proposed.
- Corrected syntax error.
- Updated example commands to maintain consistency.
- Provided more clarity.

Signed-off-by: Venkateswara Reddy Bukkasamudram <bukkasamudram@outlook.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 74cc062d24)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-06 16:52:11 +01:00
7bfe3d2006 docs: document dockerignore update
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 4f3bc15817)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-06 16:52:09 +01:00
f6ec0a368e docs: document build outputs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f7009ee126)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-06 16:52:07 +01:00
56324e6348 docs: document cache-from
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 73cd257d0f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-06 16:52:04 +01:00
040920f428 Add notice about port binding and overriding of UFW to docker run reference
Signed-off-by: Kovah <mail@kovah.de>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a955ed6477)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-06 16:52:02 +01:00
5908cdf87c Merge pull request #2302 from thaJeztah/19.03_bump_golang_1.12.16
[19.03 backport] Update Golang 1.12.16, golang.org/x/crypto (CVE-2020-0601, CVE-2020-7919)
2020-01-30 16:25:51 +01:00
3179a3b1e5 vendor: update golang.org/x/crypto 69ecbb4d6d5dab05e49161c6e77ea40a030884e1 (CVE-2020-7919)
Includes 69ecbb4d6d
(forward-port of 8b5121be2f),
which fixes CVE-2020-7919:

- Panic in crypto/x509 certificate parsing and golang.org/x/crypto/cryptobyte
  On 32-bit architectures, a malformed input to crypto/x509 or the ASN.1 parsing
  functions of golang.org/x/crypto/cryptobyte can lead to a panic.
  The malformed certificate can be delivered via a crypto/tls connection to a
  client, or to a server that accepts client certificates. net/http clients can
  be made to crash by an HTTPS server, while net/http servers that accept client
  certificates will recover the panic and are unaffected.
  Thanks to Project Wycheproof for providing the test cases that led to the
  discovery of this issue. The issue is CVE-2020-7919 and Go issue golang.org/issue/36837.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 27d9aa2d9f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-29 22:39:00 +01:00
4d630fe843 Update Golang 1.12.16 (CVE-2020-0601, CVE-2020-7919)
full diff: https://github.com/golang/go/compare/go1.12.15...go1.12.16

go1.12.16 (released 2020/01/28) includes two security fixes. One mitigates the
CVE-2020-0601 certificate verification bypass on Windows. The other affects only
32-bit architectures.

https://github.com/golang/go/issues?q=milestone%3AGo1.12.16+label%3ACherryPickApproved

- X.509 certificate validation bypass on Windows 10
  A Windows vulnerability allows attackers to spoof valid certificate chains when
  the system root store is in use. These releases include a mitigation for Go
  applications, but it’s strongly recommended that affected users install the
  Windows security update to protect their system.
  This issue is CVE-2020-0601 and Go issue golang.org/issue/36834.
- Panic in crypto/x509 certificate parsing and golang.org/x/crypto/cryptobyte
  On 32-bit architectures, a malformed input to crypto/x509 or the ASN.1 parsing
  functions of golang.org/x/crypto/cryptobyte can lead to a panic.
  The malformed certificate can be delivered via a crypto/tls connection to a
  client, or to a server that accepts client certificates. net/http clients can
  be made to crash by an HTTPS server, while net/http servers that accept client
  certificates will recover the panic and are unaffected.
  Thanks to Project Wycheproof for providing the test cases that led to the
  discovery of this issue. The issue is CVE-2020-7919 and Go issue golang.org/issue/36837.
  This is also fixed in version v0.0.0-20200124225646-8b5121be2f68 of golang.org/x/crypto/cryptobyte.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 19fd390c36)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-29 22:23:41 +01:00
9b02509a69 Merge pull request #2291 from thaJeztah/19.03_backport_update_flag_description
[19.03 backport] Update flag description for docker rm -v
2020-01-28 16:10:01 +01:00
696605c99b Merge pull request #2292 from thaJeztah/19.03_backport_hide_unsupported_buildkit_flags
[19.03 backport] Annotate flags that are not supported by Buildkit
2020-01-27 18:19:34 +01:00
25d53feb65 Annotate flags that are not supported by Buildkit
Before this patch:

```

Usage:	docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile

Options:
      --add-host list           Add a custom host-to-IP mapping (host:ip)
      --build-arg list          Set build-time variables
      --cache-from strings      Images to consider as cache sources
      --cgroup-parent string    Optional parent cgroup for the container
      --cpu-period int          Limit the CPU CFS (Completely Fair Scheduler) period
      --cpu-quota int           Limit the CPU CFS (Completely Fair Scheduler) quota
  -c, --cpu-shares int          CPU shares (relative weight)
      --cpuset-cpus string      CPUs in which to allow execution (0-3, 0,1)
      --cpuset-mems string      MEMs in which to allow execution (0-3, 0,1)
      --disable-content-trust   Skip image verification (default true)
  -f, --file string             Name of the Dockerfile (Default is 'PATH/Dockerfile')
      --force-rm                Always remove intermediate containers
      --iidfile string          Write the image ID to the file
      --isolation string        Container isolation technology
      --label list              Set metadata for an image
  -m, --memory bytes            Memory limit
      --memory-swap bytes       Swap limit equal to memory plus swap: '-1' to enable unlimited swap
      --network string          Set the networking mode for the RUN instructions during build (default "default")
      --no-cache                Do not use cache when building the image
  -o, --output stringArray      Output destination (format: type=local,dest=path)
      --platform string         Set platform if server is multi-platform capable
      --progress string         Set type of progress output (auto, plain, tty). Use plain to show container output (default "auto")
      --pull                    Always attempt to pull a newer version of the image
  -q, --quiet                   Suppress the build output and print image ID on success
      --rm                      Remove intermediate containers after a successful build (default true)
      --secret stringArray      Secret file to expose to the build (only if BuildKit enabled): id=mysecret,src=/local/secret
      --security-opt strings    Security options
      --shm-size bytes          Size of /dev/shm
      --squash                  Squash newly built layers into a single new layer
      --ssh stringArray         SSH agent socket or keys to expose to the build (only if BuildKit enabled) (format: default|<id>[=<socket>|<key>[,<key>]])
  -t, --tag list                Name and optionally a tag in the 'name:tag' format
      --target string           Set the target build stage to build.
      --ulimit ulimit           Ulimit options (default [])
```

With this patch applied:

```
DOCKER_BUILDKIT=1 docker build --help

Usage:	docker build [OPTIONS] PATH | URL | -

Build an image from a Dockerfile

Options:
      --add-host list           Add a custom host-to-IP mapping (host:ip)
      --build-arg list          Set build-time variables
      --cache-from strings      Images to consider as cache sources
      --disable-content-trust   Skip image verification (default true)
  -f, --file string             Name of the Dockerfile (Default is 'PATH/Dockerfile')
      --iidfile string          Write the image ID to the file
      --isolation string        Container isolation technology
      --label list              Set metadata for an image
      --network string          Set the networking mode for the RUN instructions during build (default "default")
      --no-cache                Do not use cache when building the image
  -o, --output stringArray      Output destination (format: type=local,dest=path)
      --platform string         Set platform if server is multi-platform capable
      --progress string         Set type of progress output (auto, plain, tty). Use plain to show container output (default "auto")
      --pull                    Always attempt to pull a newer version of the image
  -q, --quiet                   Suppress the build output and print image ID on success
      --secret stringArray      Secret file to expose to the build (only if BuildKit enabled): id=mysecret,src=/local/secret
      --squash                  Squash newly built layers into a single new layer
      --ssh stringArray         SSH agent socket or keys to expose to the build (only if BuildKit enabled) (format: default|<id>[=<socket>|<key>[,<key>]])
  -t, --tag list                Name and optionally a tag in the 'name:tag' format
      --target string           Set the target build stage to build.
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7eecbb96af)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-27 15:57:30 +01:00
1d540a50d0 Update flag description for docker rm -v
The `-v` option removes anonymous volume only, and keeps
named volumes.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8f5379b301)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-27 15:53:37 +01:00
16d5974584 Merge pull request #2276 from thaJeztah/19.03_backport_bump_golang_1.12.15
[19.03 backport] Update Golang 1.12.15
2020-01-21 14:36:04 +01:00
3694e78a56 Update Golang 1.12.15
full diff: https://github.com/golang/go/compare/go1.12.14...go1.12.15

go1.12.15 (released 2020/01/09) includes fixes to the runtime and the net/http
package. See the Go 1.12.15 milestone on the issue tracker for details:

https://github.com/golang/go/issues?q=milestone%3AGo1.12.15+label%3ACherryPickApproved

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 84c6b08cf6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-21 13:11:24 +01:00
998d8235c3 Bump Golang 1.12.14
go1.12.14 (released 2019/12/04) includes a fix to the runtime. See the Go 1.12.14
milestone on our issue tracker for details:

https://github.com/golang/go/issues?q=milestone%3AGo1.12.14+label%3ACherryPickApproved

Update Golang 1.12.13
------------------------

go1.12.13 (released 2019/10/31) fixes an issue on macOS 10.15 Catalina where the
non-notarized installer and binaries were being rejected by Gatekeeper. Only macOS
users who hit this issue need to update.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 4beea58531)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-21 13:11:17 +01:00
a3e131b323 Merge pull request #2264 from thaJeztah/19.03_backport_passthrough_user_pass
[19.03 backport] Allow username/password in config file
2020-01-17 14:53:33 +01:00
7a9a020688 Merge pull request #2265 from thaJeztah/19.03_backport_fix_pull_test
[19.03 backport] fix(pull_test): for quiet option
2020-01-17 14:49:03 +01:00
39676cc33e Merge pull request #2266 from thaJeztah/19.03_backport_circleci_updates
[19.03 backport] CircleCI: add some info steps, and re-group jobs
2020-01-17 14:47:14 +01:00
4b4e4c2504 Merge pull request #2267 from thaJeztah/19.03_backport_fix_print
[19.03 backport] fix formatting issue of encoded url
2020-01-17 14:46:14 +01:00
66905dcff8 Merge pull request #2268 from thaJeztah/19.03_backport_docs_changes
[19.03 backport] assorted documentation changes
2020-01-17 14:44:41 +01:00
05aa524a7b Change example networks
Signed-off-by: Oscar Wieman <oscar@oscarr.nl>
(cherry picked from commit 2d6aec78a1)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:59:38 +01:00
3f39587e3b Add docs for proxy configuration in config.json
Setting proxy-configuration in config.json was added in
commit 35f1e301b5 (docker
17.07), but never found its way to the documentation.

This patch adds some basic information about the feature.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e70d6bcb8a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:59:07 +01:00
e22f088abb Fixing some links and deleting an older page reference
Signed-off-by: Adrian Plata <adrian.plata@docker.com>
(cherry picked from commit 8195512206)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:57:47 +01:00
ae7bb665e7 Update service_create.md
Typo in word propagation.

Signed-off-by: Jose Escobar <joseescobar@JE-MBP15-2017.local>
(cherry picked from commit 265bee4d57)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:56:59 +01:00
f0bf0d2c46 Docs: add note about management commands targeting a manager
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f540eae7fe)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:56:23 +01:00
Sam
5761759e43 fix formatting issue of encoded url
Signed-off-by: Sam <samashah@microsoft.com>
(cherry picked from commit ee76ac8f93)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:48:54 +01:00
e669be6a1b CircleCI: add some info steps, and re-group jobs
This patch:

- Combines the shellcheck and lint stages. Free CircleCI plans allow a maximum
  of 4 concurrent jobs, and from the timing, the "lint" and "shellcheck" stages
  combined would still take less time than the other stages, so combining them
  keeps the same overall duration, but saving one machine "slot".
- Splits some steps, so that their output can be found more easily in the CI
  results. For example, separating building of Docker images from running them.
- Adds a "Docker info" step, because information about the environment can be
  useful when debugging.
- Adds the "Docker info" and "Docker version" steps to all stages, so that it's
  possible to get that information without having to find the stage in which
  it's printed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 937e65cac5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:45:00 +01:00
8291738733 fix(pull_test): for quiet option
Signed-off-by: Teppei Fukuda <knqyf263@gmail.com>
(cherry picked from commit 7634872a39)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:40:54 +01:00
a42f8129fd Fix lint issue
Signed-off-by: Jon Johnson <jonjohnson@google.com>
(cherry picked from commit 8f11fbc876)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:37:04 +01:00
41b01f1319 Add test case to cover non-empty auth entry
Signed-off-by: Jon Johnson <jonjohnson@google.com>
(cherry picked from commit 415f608620)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:36:56 +01:00
a1c4a0f9e8 Allow username/password in config file
Signed-off-by: Jon Johnson <jonjohnson@google.com>
(cherry picked from commit 37e9cabf11)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-17 13:36:48 +01:00
ab4a5cc0f7 Merge pull request #2195 from tiborvass/19.03-fix-cp
[19.03 backport] cp: allow trailing slash in non-existant destination
2020-01-16 22:39:34 +01:00
a7cad2fec2 Merge pull request #2184 from thaJeztah/19.03_backport_fix_max_replicas_per_node_interpolation
[19.03 backport] Add interpolation type cast for max_replicas_per_node
2020-01-16 21:17:38 +01:00
e6e0fa0c8f Merge pull request #2261 from zappy-shu/19.03_backport_2250-reverse-port-long-format-order
[19.03 backport] Reverse order of long-form ports
2020-01-16 15:02:24 +01:00
813cc7ed9c Reverse order of long-form ports
Reverses the order long-form port options when converted to short-form
to correctly match the documentation and `docker service create`.

Post change `-p published=8111,target=8112` is the equivalent of
`8111:8112`

Signed-off-by: Nick Adcock <nick.adcock@docker.com>
(cherry picked from commit 154a1f6df8)
Signed-off-by: Nick Adcock <nick.adcock@docker.com>
2020-01-16 12:29:56 +00:00
2c7de2070e Merge pull request #2239 from thaJeztah/19.03_backport_carry_golangci_lint
[19.03 backport] Replace gometalinter with Golangci lint [carry 1797]
2020-01-06 16:33:04 +01:00
3d91ba436c Merge pull request #2240 from thaJeztah/19.03_backport_carry_platform_docs
[19.03 backport] docs: document from platform
2020-01-06 16:22:35 +01:00
b5e0dca08d docs: document from platform
Co-Authored-By: Tibor Vass <tiborvass@users.noreply.github.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ce42168940)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 15:23:32 +01:00
7374c0a152 Remove now obsolete gometalinter and use golangci-lint instead
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b7e06f2845)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:23:38 +01:00
e70edc3576 cli/command/stack/kubernetes: Using the variable on range scope c in function literal (scopelint)
```
cli/command/stack/kubernetes/convert_test.go:199:35: Using the variable on range scope `c` in function literal (scopelint)
			conv, err := NewStackConverter(c.version)
			                               ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 640305f33c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:04 +01:00
b320feff9b cli/command/container: Using the variable on range scope c in function literal (scopelint)
```
cli/command/container/create_test.go:120:20: Using the variable on range scope `c` in function literal (scopelint)
				defer func() { c.ResponseCounter++ }()
				               ^
cli/command/container/create_test.go:121:12: Using the variable on range scope `c` in function literal (scopelint)
				switch c.ResponseCounter {
				       ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 542f80241e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:03 +01:00
73dad4356e cli/command/stack/kubernetes: Using a reference for the variable on range scope obj (scopelint)
```
cli/command/stack/kubernetes/watcher_test.go:44:20: Using a reference for the variable on range scope `obj` (scopelint)
		if err := o.Add(&obj); err != nil {
		                 ^
cli/command/stack/kubernetes/watcher_test.go:49:20: Using a reference for the variable on range scope `obj` (scopelint)
		if err := o.Add(&obj); err != nil {
		                 ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 754fc6fe67)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:02 +01:00
201e44907d opts: Using the variable on range scope tc in function literal (scopelint)
```
opts/network_test.go:74:35: Using the variable on range scope `tc` in function literal (scopelint)
			assert.NilError(t, network.Set(tc.value))
			                               ^
opts/network_test.go:102:40: Using the variable on range scope `tc` in function literal (scopelint)
			assert.ErrorContains(t, network.Set(tc.value), tc.expectedError)
			                                    ^
opts/opts_test.go:270:30: Using the variable on range scope `tc` in function literal (scopelint)
			val, err := ValidateLabel(tc.value)
			                          ^
opts/opts_test.go:271:7: Using the variable on range scope `tc` in function literal (scopelint)
			if tc.expectedErr != "" {
			   ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c2b069f4db)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:02 +01:00
1b35214c11 cli/manifest: Using the variable on range scope testcase in function literal (scopelint)
```
cli/manifest/store/store_test.go:97:29: Using the variable on range scope `testcase` in function literal (scopelint)
			actual, err := store.Get(testcase.listRef, testcase.manifestRef)
			                         ^
cli/manifest/store/store_test.go:98:7: Using the variable on range scope `testcase` in function literal (scopelint)
			if testcase.expectedErr != "" {
			   ^
cli/manifest/store/store_test.go:99:26: Using the variable on range scope `testcase` in function literal (scopelint)
				assert.Error(t, err, testcase.expectedErr)
				                     ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit cd3dca37b8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:01 +01:00
fccc105d4d cli/compose/template: Using the variable on range scope tc in function literal (scopelint)
```
cli/compose/template/template_test.go:279:31: Using the variable on range scope `tc` in function literal (scopelint)
			actual := ExtractVariables(tc.dict, defaultPattern)
			                           ^
cli/compose/template/template_test.go:280:41: Using the variable on range scope `tc` in function literal (scopelint)
			assert.Check(t, is.DeepEqual(actual, tc.expected))
			                                     ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit aafe3df8b3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:00 +01:00
37ef1f56f7 cli/command/container: suppress dogsled warnings
```
cli/command/container/opts_test.go:68:2: declaration has 3 blank identifiers (dogsled)
	_, _, _, err := parseRun(strings.Split(args+" ubuntu bash", " "))
	^
cli/command/container/opts_test.go:542:2: declaration has 3 blank identifiers (dogsled)
	_, _, _, err = parseRun([]string{"--uts=container:", "img", "cmd"})
	^
cli/command/container/opts_test.go:603:2: declaration has 3 blank identifiers (dogsled)
	_, _, _, err := parseRun([]string{"--rm", "--restart=always", "img", "cmd"})
	^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 79dc83e78b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:17:00 +01:00
65e0d7c562 e2e: remove unnecessary trailing newline (whitespace)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit dd4d216afd)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:59 +01:00
09c94458c7 internal: remove unnecessary newlines (whitespace)
```
internal/licenseutils/client_test.go:98: unnecessary leading newline (whitespace)
func (c *fakeLicensingClient) LoadLocalLicense(ctx context.Context, dclnt licensing.WrappedDockerClient) (*model.Subscription, error) {
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 63e45e6320)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:59 +01:00
be5a3ccb7d cli/command: Using the variable on range scope testcase in function literal (scopelint)
```
cli/command/cli_test.go:157:15: Using the variable on range scope `testcase` in function literal (scopelint)
				pingFunc: testcase.pingFunc,
				          ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2ec424a2d9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:58 +01:00
b083f625e4 cli: remove unnecessary newlines (whitespace)
```
cli/config/config_test.go:465: unnecessary trailing newline (whitespace)

}
cli/compose/interpolation/interpolation.go:56: unnecessary leading newline (whitespace)
	switch value := value.(type) {

cli/compose/interpolation/interpolation.go:94: unnecessary trailing newline (whitespace)

	}
cli/command/image/build/context.go:348: unnecessary trailing newline (whitespace)

		}
internal/licenseutils/client_test.go:98: unnecessary leading newline (whitespace)
func (c *fakeLicensingClient) LoadLocalLicense(ctx context.Context, dclnt licensing.WrappedDockerClient) (*model.Subscription, error) {

cli/registry/client/fetcher.go:211: unnecessary leading newline (whitespace)
	for _, endpoint := range endpoints {
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 612d83d6df)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:57 +01:00
f7b23cf572 cli/command/trust: Using the variable on range scope keyBytes in function literal (scopelint)
```
cli/command/trust/key_load_test.go:121:27: Using the variable on range scope `keyID` in function literal (scopelint)
			testLoadKeyFromPath(t, keyID, keyBytes)
			                       ^
cli/command/trust/key_load_test.go:176:32: Using the variable on range scope `keyBytes` in function literal (scopelint)
			testLoadKeyTooPermissive(t, keyBytes)
			                            ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7c4b63b1c3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:56 +01:00
bda413e0ae cli/command/context: Using the variable on range scope c in function literal (scopelint)
```
cli/command/context/create_test.go:270:31: Using the variable on range scope `c` in function literal (scopelint)
				Name:                     c.name,
				                          ^
cli/command/context/create_test.go:271:31: Using the variable on range scope `c` in function literal (scopelint)
				Description:              c.description,
				                          ^
cli/command/context/create_test.go:272:31: Using the variable on range scope `c` in function literal (scopelint)
				DefaultStackOrchestrator: c.orchestrator,

cli/command/context/create_test.go:346:31: Using the variable on range scope `c` in function literal (scopelint)
				Name:                     c.name,
				                          ^
cli/command/context/create_test.go:347:31: Using the variable on range scope `c` in function literal (scopelint)
				Description:              c.description,
				                          ^
cli/command/context/create_test.go:348:31: Using the variable on range scope `c` in function literal (scopelint)
				DefaultStackOrchestrator: c.orchestrator,
				                          ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a269e17d72)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:55 +01:00
0cab2689a5 e2e/cli-plugins: Using the variable on range scope args in function literal (scopelint)
```
e2e/cli-plugins/flags_test.go:135:27: Using the variable on range scope `args` in function literal (scopelint)
			res := icmd.RunCmd(run(args...))
			                       ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 1736662bea)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:54 +01:00
42ad2446e0 cli/compose/loader: Using a reference for the variable on range scope overrideService (scopelint)
```
cli/compose/loader/merge.go:64:41: Using a reference for the variable on range scope `overrideService` (scopelint)
			if err := mergo.Merge(&baseService, &overrideService, mergo.WithAppendSlice, mergo.WithOverride, mergo.WithTransformers(specials)); err != nil {
			                                     ^
cli/compose/loader/loader_test.go:1587:28: Using the variable on range scope `testcase` in function literal (scopelint)
			config, err := loadYAML(testcase.yaml)
			                        ^
cli/compose/loader/loader_test.go:1590:58: Using the variable on range scope `testcase` in function literal (scopelint)
			assert.Check(t, is.DeepEqual(config.Services[0].Init, testcase.init))
			                                                      ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 96ec7299d8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:53 +01:00
ae7b1f737b templates: Using the variable on range scope testCase in function literal (scopelint)
```
templates/templates_test.go:74:29: Using the variable on range scope `testCase` in function literal (scopelint)
			assert.Check(t, is.Equal(testCase.expected, b.String()))
			                         ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 54d48de216)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:53 +01:00
a087595fb6 service/logs: Using the variable on range scope testcase in function literal (scopelint)
```
service/logs/parse_logs_test.go:26:35: Using the variable on range scope `testcase` in function literal (scopelint)
			actual, err := ParseLogDetails(testcase.line)
			                               ^
service/logs/parse_logs_test.go:27:7: Using the variable on range scope `testcase` in function literal (scopelint)
			if testcase.err != nil {
			   ^
service/logs/parse_logs_test.go:28:26: Using the variable on range scope `testcase` in function literal (scopelint)
				assert.Error(t, err, testcase.err.Error())
				                     ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c828fa141d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:52 +01:00
43b498829b cli/config: Using the variable on range scope tc in function literal (scopelint)
```
cli/config/config_test.go:590:11: Using the variable on range scope `tc` in function literal (scopelint)
			SetDir(tc.dir)
			       ^
cli/config/config_test.go:591:19: Using the variable on range scope `tc` in function literal (scopelint)
			f, err := Path(tc.path...)
			               ^
cli/config/config_test.go:592:23: Using the variable on range scope `tc` in function literal (scopelint)
			assert.Equal(t, f, tc.expected)
			                   ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 5a2a9d9ca8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:51 +01:00
bd778fc27b cli/command/formatter: Error return value of ContainerWrite is not checked (errcheck)
```
cli/command/formatter/container_test.go:315:17: Error return value of `ContainerWrite` is not checked (errcheck)
		ContainerWrite(context.context, containers)
		              ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e74e2c7741)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:51 +01:00
10fda078a0 cli/command: Error return value of cli.Apply is not checked (errcheck)
```
cli/command/cli_test.go:297:11: Error return value of `cli.Apply` is not checked (errcheck)
	cli.Apply(
	         ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 008f6a2da3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:50 +01:00
49253c7b00 cli/command/formatter: Error return value of ImageWrite is not checked (errcheck)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9275e2cb66)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:50 +01:00
98150ae8ac cli/context/store: SA5001: should check returned error before deferring f.Close() (staticcheck)
```
cli/context/store/store_test.go:156:2: SA5001: should check returned error before deferring f.Close() (staticcheck)
	defer f.Close()
	^
cli/context/store/store_test.go:189:2: SA5001: should check returned error before deferring f.Close() (staticcheck)
	defer f.Close()
	^
cli/context/store/store_test.go:240:2: SA5001: should check returned error before deferring f.Close() (staticcheck)
	defer f.Close()
	^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit fe3cc6eb7b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:49 +01:00
fbe24f3e54 cli/command/image: SA1006: printf-style with no further arguments (staticcheck)
cli/command/image/build.go:434:32: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
    		fmt.Fprintf(dockerCli.Out(), imageID)
    		                             ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 709728e723)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:49 +01:00
50a23edef3 cli/command/utils: SA1006: printf-style with no further arguments (staticcheck)
```
cli/command/utils.go:81:20: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
	fmt.Fprintf(outs, message)
	                  ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ea64a1ceb9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:48 +01:00
3bfa0f36b2 cli/command/trust: SA1006: printf-style with no further arguments (staticcheck)
```
cli/command/trust/key_generate.go:91:30: SA1006: printf-style function with dynamic format string and no further arguments should use print-style function instead (staticcheck)
		fmt.Fprintf(streams.Out(), err.Error())
		                           ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f0614ca788)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:47 +01:00
acec6cb56f cli/command/image/build: G107: Potential HTTP request made with variable url (gosec)
cli/command/image/build/context.go:235: G107: Potential HTTP request made with variable url (gosec)
    	if resp, err = http.Get(url); err != nil {

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 0e4bd30cfe)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:47 +01:00
f969531205 cli/command/service: SA1012: do not pass a nil Context (staticcheck)
```
cli/command/service/update_test.go:31:16: SA1012: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (staticcheck)
	updateService(nil, nil, flags, spec)
	              ^
cli/command/service/update_test.go:535:16: SA1012: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (staticcheck)
	updateService(nil, nil, flags, spec)
	              ^
cli/command/service/update_test.go:540:16: SA1012: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (staticcheck)
	updateService(nil, nil, flags, spec)
	              ^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8d64c2af1a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:46 +01:00
c10bf24fb2 cli/command/secret: G101: Potential hardcoded credentials (gosec)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 1850a0595b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:46 +01:00
1a57296c26 cli/compose/convert: driverObjectConfig - result 1 (error) is always nil (unparam)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 34f595975d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:45 +01:00
7467a6a7de e2e/container: containerExistsWithStatus - t is unused (unparam)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6205ef33be)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:44 +01:00
98d2661522 cli/command/image/build/context_test.go:244:38: createTestTempDir - prefix always receives "builder-context-test" (unparam)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit b83545ebbc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:44 +01:00
44c8cec274 cli/command/registry/login_test.go:66:25: unnecessary conversion (unconvert)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 4be924a0af)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:43 +01:00
b2f6b4902c File is not goimports-ed (goimports)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 6047259e5a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:43 +01:00
2441946ce7 cli/compose/convert/service_test.go:274:72: unnecessary conversion (unconvert)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit c237379167)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:42 +01:00
03dbef8931 cli/command/trust/sign_test.go:119:70: unnecessary conversion (unconvert)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 0153624a56)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:41 +01:00
315715e145 Disable unparam linter: e2e/image/push_test.go:299:27: withNotaryPassphrase - pwd always receives "foo" (unparam)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit f123e43c1f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:41 +01:00
c749704b83 Disable unparam linter: cli/required.go:102:16: pluralize - word always receives "argument" (unparam)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 7d823438bb)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:40 +01:00
b49a07b63d compose/loader: define type for transformer-functions
Also explicitly type transformer-functions

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9118b2b2b8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:40 +01:00
c77f5255a4 disable unparam linter on these functions, as we need an error in these function signatures
cli/compose/loader/loader.go:756:66: transformServiceNetworkMap - result 1 (error) is always nil (unparam)
cli/compose/loader/loader.go:767:67: transformStringOrNumberList - result 1 (error) is always nil (unparam)

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6eb0c9c613)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:39 +01:00
67a7fe0b3b cli/compose/convert: result 1 (error) is always nil (unparam)
cli/compose/convert/service.go:592:76: convertDNSConfig - result 1 (error) is always nil (unparam)
cli/compose/convert/service.go:538:110: convertEndpointSpec - result 1 (error) is always nil (unparam)

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d640f44df3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:38 +01:00
9ac043bc9d cli/command/system/info.go:116:68: prettyPrintClientInfo - result 0 (error) is always nil (unparam)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 47741f81d1)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:38 +01:00
7db8c83e3a cli/command/stack/kubernetes/deploy_test.go:65:68: checkOwnerReferences - stackName always receives "test" (unparam)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit a3c7cb4f12)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:37 +01:00
a1f67cc029 cli/command/plugin/list_test.go:61:31: TestList$1 - filter is unused (unparam)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit ab1aeedb27)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:37 +01:00
a3912a4713 cli/command/image/build_session.go:133:45: getBuildSharedKey - result 1 (error) is always nil (unparam)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 75c60c1af7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:36 +01:00
20ae2a6c4e cli/command/image/build_buildkit.go:450:56: parseSSH - result 1 (error) is always nil (unparam)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 28ac2f82c6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:36 +01:00
9c7b701de5 cli/command/image/build/context_test.go:252:71: createTestTempFile - perm always receives 0777 (511) (unparam)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 0ce2eae5a2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:35 +01:00
6f91e46b7b cli/command/image/build/context_test.go:244:38: createTestTempDir - dir always receives "" (unparam)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 70bd64d037)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:35 +01:00
1f3468bb77 unchecked errors
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit e1c0c7979e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:34 +01:00
c8c14206aa cli/command/container/attach.go:141:15: nilness: impossible condition: nil != nil (govet)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 584da37756)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:33 +01:00
7d9b95d7ec opts/ulimit_test.go:11:13: composites: *github.com/docker/cli/vendor/github.com/docker/go-units.Ulimit composite literal uses unkeyed fields (govet)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit b3d4c6aac7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:33 +01:00
0f72909216 cli/compose/types/types.go:106:2: structtag: struct field tag yaml:",inline", json:"-" not compatible with reflect.StructTag.Get: key:"value" pairs not separated by spaces (govet)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 1bfe81318d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:32 +01:00
66b760d2b1 cli/registry/client/fetcher.go:106:9: nilness: impossible condition: nil != nil (govet)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 5ceed3059f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:31 +01:00
c83334119c cli/command/container/start.go:157:20: nilness: nil dereference in type assertion (govet)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 9afeb6f432)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:31 +01:00
cdc9d1095b cli/command/stack/kubernetes/list.go:32:47: nilness: tautological condition: non-nil != nil (govet)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 85cfd4e518)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:30 +01:00
fe1a85f1e9 cli/command/trust/key_generate.go:112:9: nilness: impossible condition: nil != nil (govet)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit f5e8387067)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:29 +01:00
60aa890a06 SA1019: httputil.ErrPersistEOF is deprecated: No longer used. (staticcheck)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 3a428202bf)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:29 +01:00
49ff9c82db cli/command/container/stats.go:211:21: SA1015: using time.Tick leaks the underlying ticker, consider using it only in endless functions, tests and the main package, and use time.NewTicker here (staticcheck)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 7da9360477)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:28 +01:00
1ed4e67b34 cli/command/trust/inspect_pretty_test.go:399:24: SA4010: this result of append is never used, except maybe in other appends (staticcheck)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
(cherry picked from commit 8018a850cb)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:27 +01:00
ad7bd8235f opts/throttledevice.go:51:5: SA4003: unsigned values are never < 0 (staticcheck)
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 296297190c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:26 +01:00
b71d5e32cd compose/loader: fix TestIsAbs not testing all combinations
This test was intending to run all tests, but didn't, which was
caught by golangci-lint;

    cli/compose/loader/windows_path_test.go:46:17: SA4010: this result of append is never used, except maybe in other appends (staticcheck)
    	tests := append(isabstests, winisabstests...)
    	               ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 0a21de05d2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:16:21 +01:00
3bc713c157 Gometalinter: raise deadline to 3 minutes
Looks like we're just on the edge of the deadline, and it's sometimes
failing;

```
cli/command/image/trust.go:346:1⚠️ nolint directive did not match any issue (nolint)
cli/command/manifest/push.go:211:1⚠️ nolint directive did not match any issue (nolint)
internal/pkg/containerized/snapshot.go:95:1⚠️ nolint directive did not match any issue (nolint)
internal/pkg/containerized/snapshot.go:138:1⚠️ nolint directive did not match any issue (nolint)
WARNING: deadline exceeded by linter interfacer (try increasing --deadline)
Exited with code 3
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3e78cbc021)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:12:59 +01:00
d85a3b265c gometalinter: fix configuration
The configuration abused "Exclude" to exclude file-paths by filtering
on the output, however, the `Skip` option was designed for that, whereas
`Exclude` is for matching warnings.

An explicit "Skip" was added for "vendor", because even though the vendor
directory should already be ignored by the linter, in some situations,
it still seemed to warn on issues, so let's explicitly ignore it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 71e525f74f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-01-06 13:12:45 +01:00
08b5f63b0e Merge pull request #2222 from thaJeztah/19.03_backport_fix_docker_cp_npe
[19.03 backport] docker cp: prevent NPE when failing to stat destination
2019-12-10 10:53:34 +01:00
c2d4bd4ec2 docker cp: prevent NPE when failing to stat destination
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 585ec4da97)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-12-10 09:36:13 +01:00
2fa69baf8d cp: allow trailing slash in non-existant destination
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 26dbc3226c)
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-11-12 17:26:32 +00:00
e3657b0a8c Add interpolation type cast for max_replicas_per_node
Fixes https://github.com/docker/app/issues/688

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
(cherry picked from commit cb29ef6c6d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-11-05 13:15:57 -08:00
99c5edceb4 Merge pull request #2177 from thaJeztah/19.03_backport_fix_sig_proxy
[19.03 backport] Do not disable sig-proxy when using a TTY
2019-11-04 16:55:15 -08:00
ad6c667034 Merge pull request #2178 from thaJeztah/19.03_backport_docs_updates
[19.03 backport] docs updates
2019-10-29 16:36:30 -07:00
5cef8fc8e5 Merge pull request #2176 from thaJeztah/19.03_backport_completion
[19.03 backport] completion script updates and fixes
2019-10-29 16:36:23 -07:00
9597e681cb update Jenkins Build Status urls for README
Signed-off-by: danielhelfand <helfand.4@gmail.com>
(cherry picked from commit 46f3f9ac04)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:27:54 +01:00
c050ae7fb1 Adjusting glossary reference and clarrifying the start of a Dockerfile
Signed-off-by: Brandon Mitchell <git@bmitch.net>
(cherry picked from commit 937ce69b42)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:27:42 +01:00
aa45ea366c Minor formatting changes and a typo fix.
Signed-off-by: Adrian Plata <adrian.plata@docker.com>
(cherry picked from commit ba7ec36de2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:27:28 +01:00
df5c7130df Updating deprecated command example in search.md
--stars example is deprecated. Changing to --filter=stars=5

Signed-off-by: danielartine <daniel.artine@ufrj.br>
(cherry picked from commit bba0a4d5ac)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:26:32 +01:00
a90e5598a4 Fix phrasing when referring to the freezer cgroup
Signed-off-by: Odin Ugedal <odin@ugedal.com>
(cherry picked from commit a0dd6e025d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:26:20 +01:00
66f8d279c1 builder.md: Correct copy/paste error
Signed-off-by: Daniel Cassidy <mail@danielcassidy.me.uk>
(cherry picked from commit e9ada56a88)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:26:09 +01:00
c4e5fd7e53 Explain -s flag on docker ps
https://github.com/docker/docker.github.io/issues/1520#issuecomment-467971886

Signed-off-by: Forest Johnson <fjohnson@peoplenetonline.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f7ab2987c3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:25:56 +01:00
149f69ca06 TestSigProxyWithTTY: fix
exec.CombinedOutput should not be used here because:
 - it redirects cmd Stdout and Stderr and we want it to be the tty
 - it calls cmd.Run which we already did

While at it
 - use pty.Start() as it is cleaner
 - make sure we don't leave a zombie running, by calling Wait() in defer
 - use test.Name() for containerName

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit bc4ed69a23)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:20:53 +01:00
79f5dbcd55 Add test for --sig-proxy with a TTY
Add a test to verify that killing the docker CLI forwards
the signal to the container. Test-case for moby/moby 28872

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7cf1a8d4c9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:19:30 +01:00
137b3cc89e Do not disable sig-proxy when using a TTY
This partially reverts e0b59ab52b,
and does not automatically disable proxying signals in TTY-mode

Before this change:
------------------------------------

Start a container with a TTY in one shell:

```
docker run -it --init --name repro-28872 busybox sleep 30
```

then, in another shell, kill the docker cli:

```
kill `pgrep -f repro-28872`
```

Notice that the CLI was killed, but the signal not forwarded to the container;
the container continues running

```
docker container inspect --format '{{ .State.Status }}' repro-28872
running

docker container rm -f repro-28872
```

After this change:
------------------------------------

Start a container with a TTY in one shell:

```
docker run -it --init --name repro-28872 busybox sleep 30
```

then, in another shell, kill the docker cli:

```
kill `pgrep -f repro-28872`
```

Verify that the signal was forwarded to the container, and the container exited

```
docker container inspect --format '{{ .State.Status }}' repro-28872
exited

docker container rm -f repro-28872
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ee29504923)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:19:21 +01:00
57332bcea3 Add bash completion for builder build options
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit cd9b39fc52)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:11:42 +01:00
2fe281d170 Add bash completion for builder build
Signed-off-by: Trapier Marshall <trapier.marshall@docker.com>
(cherry picked from commit 86ae871e0a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:11:28 +01:00
69f0132397 Fix erroneous space indentation of shell script
Signed-off-by: Morten Hekkvang <morten.hekkvang@sbab.se>
(cherry picked from commit fc19fb6d95)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:11:15 +01:00
9447d7431b Move filtering to __docker_complete_services, as suggested by @albers
Signed-off-by: Morten Hekkvang <morten.hekkvang@sbab.se>
(cherry picked from commit 6ebcc211a7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:11:13 +01:00
c70ce79adc Fix substitution of comma to space character, suggested by @albers
Signed-off-by: Morten Hekkvang <morten.hekkvang@sbab.se>
(cherry picked from commit b85e1e2efe)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:11:10 +01:00
667bd9a1b8 Make service completion faster
Signed-off-by: Morten Hekkvang <morten.hekkvang@sbab.se>
(cherry picked from commit f55c5b6566)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:11:08 +01:00
6c66c799c7 add rudimentary fish completions for docker network
Signed-off-by: Tim Sampson <tim@sampson.fi>
(cherry picked from commit 2f7b364cb3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-29 15:10:42 +01:00
8a9e86c728 Merge pull request #2124 from chris-crone/backport-19.03-env-merge
[19.03 backport] Add option to remove `env_file` entry once it's merged in the `environment` section
2019-10-22 14:52:48 -07:00
e176053a3f Merge pull request #2150 from thaJeztah/19.03_backport_bump_golang_1.12.12
[19.03 backport] Update Golang 1.12.12 (CVE-2019-17596)
2019-10-22 14:50:04 -07:00
f38bea4ac3 Update Golang 1.12.12 (CVE-2019-17596)
Golang 1.12.12
-------------------------------

full diff: https://github.com/golang/go/compare/go1.12.11...go1.12.12

go1.12.12 (released 2019/10/17) includes fixes to the go command, runtime,
syscall and net packages. See the Go 1.12.12 milestone on our issue tracker for
details.

https://github.com/golang/go/issues?q=milestone%3AGo1.12.12

Golang 1.12.11 (CVE-2019-17596)
-------------------------------

full diff: https://github.com/golang/go/compare/go1.12.10...go1.12.11

go1.12.11 (released 2019/10/17) includes security fixes to the crypto/dsa
package. See the Go 1.12.11 milestone on our issue tracker for details.

https://github.com/golang/go/issues?q=milestone%3AGo1.12.11

    [security] Go 1.13.2 and Go 1.12.11 are released

    Hi gophers,

    We have just released Go 1.13.2 and Go 1.12.11 to address a recently reported
    security issue. We recommend that all affected users update to one of these
    releases (if you're not sure which, choose Go 1.13.2).

    Invalid DSA public keys can cause a panic in dsa.Verify. In particular, using
    crypto/x509.Verify on a crafted X.509 certificate chain can lead to a panic,
    even if the certificates don't chain to a trusted root. The chain can be
    delivered via a crypto/tls connection to a client, or to a server that accepts
    and verifies client certificates. net/http clients can be made to crash by an
    HTTPS server, while net/http servers that accept client certificates will
    recover the panic and are unaffected.

    Moreover, an application might crash invoking
    crypto/x509.(*CertificateRequest).CheckSignature on an X.509 certificate
    request, parsing a golang.org/x/crypto/openpgp Entity, or during a
    golang.org/x/crypto/otr conversation. Finally, a golang.org/x/crypto/ssh client
    can panic due to a malformed host key, while a server could panic if either
    PublicKeyCallback accepts a malformed public key, or if IsUserAuthority accepts
    a certificate with a malformed public key.

    The issue is CVE-2019-17596 and Go issue golang.org/issue/34960.

    Thanks to Daniel Mandragona for discovering and reporting this issue. We'd also
    like to thank regilero for a previous disclosure of CVE-2019-16276.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 474d522ee2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-22 03:48:54 +02:00
379470969b Add option remove env_file entry after merged
This avoids having a redundant `env_file` entry
output when rendering the compose file

Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
(cherry picked from commit 821f5ecf53)
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
2019-10-04 17:32:48 +02:00
2355349d8b Merge pull request #2119 from thaJeztah/19.03_backport_bump_yaml.v2_2.2.3
[19.03 backport] vendor: Bump gopkg.in/yaml.v2
2019-10-03 10:52:44 -07:00
73d513e56a Merge pull request #2120 from thaJeztah/19.03_backport_experimental_note
[19.03 backport] backport docs changes
2019-10-01 14:27:56 -07:00
9fd5604d80 Adding experimental feature info
Signed-off-by: Adrian Plata <adrian.plata@docker.com>
(cherry picked from commit 031bd2d530)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-01 19:11:06 +02:00
82ac89901f Clarifying docker config rules
Signed-off-by: Adrian Plata <adrian.plata@docker.com>
(cherry picked from commit 131eefc54f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-01 19:11:01 +02:00
29e3a70b04 vendor: Bump gopkg.in/yaml.v2
Signed-off-by: Christopher Crone <christopher.crone@docker.com>
(cherry picked from commit 91cf8b04c9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-01 14:54:49 +02:00
3fb239756d Merge pull request #2113 from thaJeztah/19.03_backport_bump_golang_1.12.10
[19.03 backport] bump golang 1.12.10 (CVE-2019-16276)
2019-09-28 01:53:31 +02:00
ff72c27a7a bump golang 1.12.10 (CVE-2019-16276)
full diff: https://github.com/golang/go/compare/go1.12.9...go1.12.10

```
Hi gophers,

We have just released Go 1.13.1 and Go 1.12.10 to address a recently reported security issue. We recommend that all affected users update to one of these releases (if you're not sure which, choose Go 1.13.1).

net/http (through net/textproto) used to accept and normalize invalid HTTP/1.1 headers with a space before the colon, in violation of RFC 7230. If a Go server is used behind an uncommon reverse proxy that accepts and forwards but doesn't normalize such invalid headers, the reverse proxy and the server can interpret the headers differently. This can lead to filter bypasses or request smuggling, the latter if requests from separate clients are multiplexed onto the same upstream connection by the proxy. Such invalid headers are now rejected by Go servers, and passed without normalization to Go client applications.

The issue is CVE-2019-16276 and Go issue golang.org/issue/34540.

Thanks to Andrew Stucki, Adam Scarr (99designs.com), and Jan Masarik (masarik.sh) for discovering and reporting this issue.

Downloads are available at https://golang.org/dl for all supported platforms.

Alla prossima,
Filippo on behalf of the Go team
```

From the patch: 6e6f4aaf70

```
net/textproto: don't normalize headers with spaces before the colon

RFC 7230 is clear about headers with a space before the colon, like

X-Answer : 42

being invalid, but we've been accepting and normalizing them for compatibility
purposes since CL 5690059 in 2012.

On the client side, this is harmless and indeed most browsers behave the same
to this day. On the server side, this becomes a security issue when the
behavior doesn't match that of a reverse proxy sitting in front of the server.

For example, if a WAF accepts them without normalizing them, it might be
possible to bypass its filters, because the Go server would interpret the
header differently. Worse, if the reverse proxy coalesces requests onto a
single HTTP/1.1 connection to a Go server, the understanding of the request
boundaries can get out of sync between them, allowing an attacker to tack an
arbitrary method and path onto a request by other clients, including
authentication headers unknown to the attacker.

This was recently presented at multiple security conferences:
https://portswigger.net/blog/http-desync-attacks-request-smuggling-reborn

net/http servers already reject header keys with invalid characters.
Simply stop normalizing extra spaces in net/textproto, let it return them
unchanged like it does for other invalid headers, and let net/http enforce
RFC 7230, which is HTTP specific. This loses us normalization on the client
side, but there's no right answer on the client side anyway, and hiding the
issue sounds worse than letting the application decide.
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8743e36a45)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-27 23:33:06 +02:00
ed54e85144 Merge pull request #2079 from thaJeztah/19.03_backport_bump_pkcs11
[19.03 backport] bump miekg/pkcs11 v1.0.2
2019-09-27 13:41:10 +02:00
0bc3d1fd2d bump miekg/pkcs11 v1.0.2
full diff: 6120d95c0e...v1.0.2

relevant changes:

- miekg/pkcs11#110 Fix issue freeing memory on GetOperationState when NOT CK_OK
- miekg/pkcs11#106 Move to go modules
- miekg/pkcs11#104 Expose login API for vendor specific login types

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 54428b1f37)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-27 11:51:03 +02:00
50bb8c70f3 Merge pull request #2102 from tiborvass/19.03-buildkit-vendor
[19.03] vendor: update buildkit to docker-19.03
2019-09-23 18:18:48 -07:00
25168137bd vendor: update buildkit to docker-19.03
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-24 00:36:30 +00:00
3af5c3f8c6 Merge pull request #2099 from thaJeztah/19.03_backport_bump_vndr
[19.03 backport] bump LK4D4/vndr v0.0.3 and revendor
2019-09-23 16:59:17 -07:00
3143ba5700 bump LK4D4/vndr v0.0.3 and revendor
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 909b85460c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-23 19:30:55 +02:00
a89484e338 Merge pull request #2090 from thaJeztah/19.03_backport_bump_go_1.12.9
[19.03 backport] Bump golang 1.12.9
2019-09-23 10:21:02 -07:00
2ac9213069 Bump golang 1.12.9
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
(cherry picked from commit d9856049e5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-16 16:35:02 +02:00
578ab52ece Merge pull request #2048 from thaJeztah/19.03_backport_ci_improvements
[19.03 backport] CI and testing improvements
2019-08-22 10:57:08 -07:00
c8e9c04d19 Merge pull request #2061 from thaJeztah/19.03_backport_issue39654
[19.03 backport] restore support for env variables to configure proxy
2019-08-22 19:55:05 +02:00
2fead2a50f restore support for env variables to configure proxy
regression introduced by b34f34
close #39654

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
(cherry picked from commit e25e077a20)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-22 19:11:41 +02:00
df1fe15cf6 Merge pull request #1985 from thaJeztah/19.03_backport_consistent_output_on_context_create
[19.03 backport] context: produce consistent output on `context create`.
2019-08-22 10:19:01 +02:00
be9adbd5c1 e2e: remove docker engine testing remnants
These changes were made as part of the `docker engine` feature
in commit fd2f1b3b66, but later
reverted in f250152bf4 and
b7ec4a42d9

These lines were forgotten to be removed, and should no longer
be needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit de01e72455)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-15 03:19:38 +02:00
2907276eca e2e: enable buildkit
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 893db86d6e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-15 03:18:42 +02:00
59b02c04bf Circle-CI: use progress=plain
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ae58e356ea)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-15 03:18:39 +02:00
6a3eb417d5 Circle-CI: enable buildkit
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9a6519db76)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-15 03:18:37 +02:00
c30ccb308d Update dockerignore
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 82e01807bc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-15 03:18:34 +02:00
1572845a2f Update CircleCI Docker version to 18.09.3
18.03 has reached EOL; let's use a more current version in CI

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8b19c1d73a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-15 03:16:52 +02:00
caad34cf58 Circle-CI: fix indentation in circle.yml
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 53fc63a93f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-15 03:16:49 +02:00
bf683dfe52 Merge pull request #2044 from thaJeztah/19.03_backport_bump_golang_1.12.8
[19.03 backport] Bump golang 1.12.8 (CVE-2019-9512, CVE-2019-9514)
2019-08-14 11:55:59 -07:00
307befd7e2 Adjust tests for changes in Go 1.12.8 / 1.11.13
For now, just verifying that an error is returned, but not checking the
error message itself, because those are not under our control, and may
change with different Go versions.

```
=== Failed
=== FAIL: opts TestParseDockerDaemonHost (0.00s)
    hosts_test.go:87: tcp tcp:a.b.c.d address expected error "Invalid bind address format: tcp:a.b.c.d" return, got "parse tcp://tcp:a.b.c.d: invalid port \":a.b.c.d\" after host" and addr
    hosts_test.go:87: tcp tcp:a.b.c.d/path address expected error "Invalid bind address format: tcp:a.b.c.d/path" return, got "parse tcp://tcp:a.b.c.d/path: invalid port \":a.b.c.d\" after host" and addr

=== FAIL: opts TestParseTCP (0.00s)
    hosts_test.go:129: tcp tcp:a.b.c.d address expected error Invalid bind address format: tcp:a.b.c.d return, got parse tcp://tcp:a.b.c.d: invalid port ":a.b.c.d" after host and addr
    hosts_test.go:129: tcp tcp:a.b.c.d/path address expected error Invalid bind address format: tcp:a.b.c.d/path return, got parse tcp://tcp:a.b.c.d/path: invalid port ":a.b.c.d" after host and addr
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit de1523d221)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-14 10:20:43 +02:00
b58270ba69 Bump golang 1.12.8 (CVE-2019-9512, CVE-2019-9514)
go1.12.8 (released 2019/08/13) includes security fixes to the net/http and net/url packages.
See the Go 1.12.8 milestone on our issue tracker for details:

https://github.com/golang/go/issues?q=milestone%3AGo1.12.8

- net/http: Denial of Service vulnerabilities in the HTTP/2 implementation
  net/http and golang.org/x/net/http2 servers that accept direct connections from untrusted
  clients could be remotely made to allocate an unlimited amount of memory, until the program
  crashes. Servers will now close connections if the send queue accumulates too many control
  messages.
  The issues are CVE-2019-9512 and CVE-2019-9514, and Go issue golang.org/issue/33606.
  Thanks to Jonathan Looney from Netflix for discovering and reporting these issues.
  This is also fixed in version v0.0.0-20190813141303-74dc4d7220e7 of golang.org/x/net/http2.
  net/url: parsing validation issue
- url.Parse would accept URLs with malformed hosts, such that the Host field could have arbitrary
  suffixes that would appear in neither Hostname() nor Port(), allowing authorization bypasses
  in certain applications. Note that URLs with invalid, not numeric ports will now return an error
  from url.Parse.
  The issue is CVE-2019-14809 and Go issue golang.org/issue/29098.
  Thanks to Julian Hector and Nikolai Krein from Cure53, and Adi Cohen (adico.me) for discovering
  and reporting this issue.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit bbd179f25b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-14 03:03:11 +02:00
0ecfcb5997 Dockerfile: use GO_VERSION build-arg for overriding Go version
This allows overriding the version of Go without making modifications in the
source code, which can be useful to test against multiple versions.

For example:

    make GO_VERSION=1.13beta1 -f docker.Makefile binary

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 0d3022c6d2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-14 03:03:04 +02:00
0ea69840c6 Merge pull request #1970 from thaJeztah/19.03_backport_skip_windows_permissions_check
[19.03 backport] Windows: skip permissions check on key
2019-08-09 20:17:09 +02:00
208de55a17 Merge pull request #1983 from thaJeztah/19.03_backport_bump_credential_helpers
[19.03 backport] bump docker-credential-helpers v0.6.3
2019-08-07 19:02:50 -07:00
1a8077b814 Merge pull request #1998 from thaJeztah/19.03_backport_bump_golang_1.12.7
[19.03 backport] Bump golang 1.12.7
2019-08-07 17:48:16 -07:00
fa0e2597e6 Merge pull request #2022 from thaJeztah/19.03_backport_fix_e2e
[19.03 backport] Disable TLS for e2e docker-in-docker daemon
2019-08-07 17:29:48 -07:00
f357def036 Disable TLS for e2e docker-in-docker daemon
The docker-in-docker image now enables TLS by default (added in
docker-library/docker#166), which complicates testing in our
environment, and isn't needed for the tests we're running.

This patch sets the `DOCKER_TLS_CERTDIR` to an empty value to
disable TLS.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b1a3c1aad1)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-29 17:11:28 -07:00
792ce891be e2e: use stable-dind image for testing
The edge channel is deprecated and no longer updated

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 08fd6dd63c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-29 17:11:25 -07:00
d473c60571 Merge pull request #1995 from thaJeztah/19.03_backport_cross_platform_bind
[19.03 backport] Detect Windows absolute paths on non-Windows CLI
2019-07-26 13:11:18 -07:00
b020a36d10 Merge pull request #2001 from thaJeztah/19.03_backport_docs
[19.03 backport] assorted docs and completion script fixes
2019-07-23 14:16:08 -07:00
d2e8ff9e20 bump docker-credential-helpers v0.6.3
full diff: https://github.com/docker/docker-credential-helpers/compare/v0.6.2...v0.6.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 64f0ae4252)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-17 17:02:21 +02:00
10a899b6bd fix: docker login autocomplete for zsh
Changed `--user` to `--username`

Signed-off-by: Rohan Verma <hello@rohanverma.net>
(cherry picked from commit 1dc756e8df)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-12 16:14:52 +02:00
41718b98f6 adding nvidia gpu access info
Signed-off-by: Adrian Plata <adrian.plata@docker.com>

Removing prerequisites section.
Signed-off-by: Adrian Plata <adrian.plata@docker.com>

Removing prerequisites section.
Signed-off-by: Adrian Plata <adrian.plata@docker.com>

adding nvidia gpu access info
Signed-off-by: Adrian Plata <adrian.plata@docker.com>

Refining information.

Removing prerequisites section.

adding nvidia gpu access info
Signed-off-by: Adrian Plata <adrian.plata@docker.com>

Refining information.

Removing prerequisites section.

adding nvidia gpu access info
Signed-off-by: Adrian Plata <adrian.plata@docker.com>

Refining information.

Removing prerequisites section.

(cherry picked from commit f7b75eeb9b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-12 16:14:04 +02:00
caf21526a0 docs: add info for events backlog and scope
1. Adds `docker events` description info on the two scope types of events.
2. Adds `docker events` note in two places about backlog limit of event log.

Further info and background info in Issue 727

Signed-off-by: Bret Fisher <bret@bretfisher.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 988b9a0d96)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-12 16:13:22 +02:00
94b98bfa21 Bump golang 1.12.7
go1.12.7 (released 2019/07/08) includes fixes to cgo, the compiler, and the
linker. See the Go 1.12.7 milestone on our issue tracker for details:
https://github.com/golang/go/issues?q=milestone%3AGo1.12.7

full diff: https://github.com/golang/go/compare/go1.12.6...go1.12.7

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b06f9e9595)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-11 14:10:40 +02:00
87e400e44e Detect Windows absolute paths on non-Windows CLI
When deploying a stack using a relative path as bind-mount
source in the compose file, the CLI converts the relative
path to an absolute path, relative to the location of the
docker-compose file.

This causes a problem when deploying a stack that uses
an absolute Windows path, because a non-Windows client will
fail to detect that the path (e.g. `C:\somedir`) is an absolute
path (and not a relative directory named `C:\`).

The existing code did already take Windows clients deploying
a Linux stack into account (by checking if the path had a leading
slash). This patch adds the reverse, and adds detection for Windows
absolute paths on non-Windows clients.

The code used to detect Windows absolute paths is copied from the
Golang filepath package;
1d0e94b1e1/src/path/filepath/path_windows.go (L12-L65)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d6dd08d568)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-10 23:40:22 +02:00
8cb2456248 context: produce consistent output on context create.
Refactor `RunCreate` slightly so that all three paths always produce the same
output, namely the name of the new context of `stdout` (for scripting) and the
success log message on `stderr`.

Validate by extending the existing unit tests to always check the output is as
expected.

Signed-off-by: Ian Campbell <ijc@docker.com>
(cherry picked from commit ff44305c47)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-04 21:37:25 +02:00
11b15544c5 bump docker-credential-helpers v0.6.2
full diff: 5241b46610...8a9f93a99f

includes:

- docker/docker-credential-helpers#29 C.free(unsafe.Pointer(err)) -> C.g_error_free(err)
- docker/docker-credential-helpers#124 pass: changed the way for checking if password-store is initalized
  - addresses docker/docker-credential-helpers#133 docker-credential-pass commits about 10 times every time I run a docker command
- docker/docker-credential-helpers#143 Fix docker-credential-osxkeychain list behaviour in case of missing entry in keychain
- docker/docker-credential-helpers#139 make docker-credential-wincred work like docker-credential-osxkeychain

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f6a4c76fbb)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-04 21:12:56 +02:00
e803e487c3 Windows: skip permissions check on key
This code was attempting to check Linux file permissions
to determine if the key was accessible by other users, which
doesn't work, and therefore prevented users on Windows
to load keys.

Skipping this check on Windows (correspinding tests
were already skipped).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 15d361fd77)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-25 12:54:33 +02:00
296e10c0c5 Bump golang 1.12.6
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
(cherry picked from commit 459099e175)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-13 15:52:38 +02:00
650 changed files with 12879 additions and 8201 deletions

View File

@ -1,2 +1,6 @@
.dockerignore
.git
build
.gitignore
appveyor.yml
build
circle.yml

83
.golangci.yml Normal file
View File

@ -0,0 +1,83 @@
linters:
enable:
- bodyclose
- deadcode
- dogsled
- gocyclo
- goimports
- golint
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- lll
- megacheck
- misspell
- nakedret
- staticcheck
- structcheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
disable:
- errcheck
run:
timeout: 5m
skip-dirs:
- cli/command/stack/kubernetes/api/openapi
- cli/command/stack/kubernetes/api/client
skip-files:
- cli/compose/schema/bindata.go
- .*generated.*
linters-settings:
gocyclo:
min-complexity: 16
govet:
check-shadowing: false
lll:
line-length: 200
nakedret:
command: nakedret
pattern: ^(?P<path>.*?\\.go):(?P<line>\\d+)\\s*(?P<message>.*)$
issues:
# The default exclusion rules are a bit too permissive, so copying the relevant ones below
exclude-use-default: false
exclude:
- parameter .* always receives
exclude-rules:
# These are copied from the default exclude rules, except for "ineffective break statement"
# and GoDoc checks.
# https://github.com/golangci/golangci-lint/blob/0cc87df732aaf1d5ad9ce9ca538d38d916918b36/pkg/config/config.go#L36
- text: "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*printf?|os\\.(Un)?Setenv). is not checked"
linters:
- errcheck
- text: "func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this"
linters:
- golint
- text: "G103: Use of unsafe calls should be audited"
linters:
- gosec
- text: "G104: Errors unhandled"
linters:
- gosec
- text: "G204: Subprocess launch(ed with (variable|function call)|ing should be audited)"
linters:
- gosec
- text: "(G301|G302): (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)"
linters:
- gosec
- text: "G304: Potential file inclusion via variable"
linters:
- gosec
- text: "(G201|G202): SQL string (formatting|concatenation)"
linters:
- gosec

55
Jenkinsfile vendored
View File

@ -1,12 +1,47 @@
wrappedNode(label: 'linux && x86_64', cleanWorkspace: true) {
timeout(time: 60, unit: 'MINUTES') {
stage "Git Checkout"
checkout scm
pipeline {
agent {
label "linux && x86_64"
}
stage "Run end-to-end test suite"
sh "docker version"
sh "E2E_UNIQUE_ID=clie2e${BUILD_NUMBER} \
IMAGE_TAG=clie2e${BUILD_NUMBER} \
make -f docker.Makefile test-e2e"
}
options {
timeout(time: 60, unit: 'MINUTES')
}
stages {
stage("Docker info") {
steps {
sh "docker version"
sh "docker info"
}
}
stage("e2e (non-experimental) - stable engine") {
steps {
sh "E2E_UNIQUE_ID=clie2e${BUILD_NUMBER} \
IMAGE_TAG=clie2e${BUILD_NUMBER} \
DOCKER_BUILDKIT=1 make -f docker.Makefile test-e2e-non-experimental"
}
}
stage("e2e (non-experimental) - 18.09 engine") {
steps {
sh "E2E_ENGINE_VERSION=18.09-dind \
E2E_UNIQUE_ID=clie2e${BUILD_NUMBER} \
IMAGE_TAG=clie2e${BUILD_NUMBER} \
DOCKER_BUILDKIT=1 make -f docker.Makefile test-e2e-non-experimental"
}
}
stage("e2e (experimental)") {
steps {
sh "E2E_UNIQUE_ID=clie2e${BUILD_NUMBER} \
IMAGE_TAG=clie2e${BUILD_NUMBER} \
DOCKER_BUILDKIT=1 make -f docker.Makefile test-e2e-experimental"
}
}
stage("e2e (ssh connhelper)") {
steps {
sh "E2E_UNIQUE_ID=clie2e${BUILD_NUMBER} \
IMAGE_TAG=clie2e${BUILD_NUMBER} \
DOCKER_BUILDKIT=1 make -f docker.Makefile test-e2e-connhelper-ssh"
}
}
}
}

View File

@ -1,4 +1,5 @@
[![build status](https://circleci.com/gh/docker/cli.svg?style=shield)](https://circleci.com/gh/docker/cli/tree/master) [![Build Status](https://jenkins.dockerproject.org/job/docker/job/cli/job/master/badge/icon)](https://jenkins.dockerproject.org/job/docker/job/cli/job/master/)
[![build status](https://circleci.com/gh/docker/cli.svg?style=shield)](https://circleci.com/gh/docker/cli/tree/master)
[![Build Status](https://ci.docker.com/public/job/cli/job/master/badge/icon)](https://ci.docker.com/public/job/cli/job/master)
docker/cli
==========

View File

@ -4,7 +4,7 @@ clone_folder: c:\gopath\src\github.com\docker\cli
environment:
GOPATH: c:\gopath
GOVERSION: 1.12.5
GOVERSION: 1.13.11
DEPVERSION: v0.4.1
install:

View File

@ -4,35 +4,64 @@ jobs:
lint:
working_directory: /work
docker: [{image: 'docker:18.03-git'}]
docker: [{image: 'docker:18.09-git'}]
environment:
DOCKER_BUILDKIT: 1
steps:
- checkout
- setup_remote_docker:
version: 18.03.1-ce
reusable: true
exclusive: false
version: 18.09.3
reusable: true
exclusive: false
- run:
name: "Docker version"
command: docker version
- run:
name: "Docker info"
command: docker info
- run:
name: "Shellcheck - build image"
command: |
docker build --progress=plain -f dockerfiles/Dockerfile.shellcheck --tag cli-validator:$CIRCLE_BUILD_NUM .
- run:
name: "Shellcheck"
command: |
docker run --rm cli-validator:$CIRCLE_BUILD_NUM \
make shellcheck
- run:
name: "Lint - build image"
command: |
docker build --progress=plain -f dockerfiles/Dockerfile.lint --tag cli-linter:$CIRCLE_BUILD_NUM .
- run:
name: "Lint"
command: |
docker build -f dockerfiles/Dockerfile.lint --tag cli-linter:$CIRCLE_BUILD_NUM .
docker run --rm cli-linter:$CIRCLE_BUILD_NUM
cross:
working_directory: /work
docker: [{image: 'docker:18.03-git'}]
docker: [{image: 'docker:18.09-git'}]
environment:
DOCKER_BUILDKIT: 1
parallelism: 3
steps:
- checkout
- setup_remote_docker:
version: 18.03.1-ce
reusable: true
exclusive: false
version: 18.09.3
reusable: true
exclusive: false
- run:
name: "Docker version"
command: docker version
- run:
name: "Docker info"
command: docker info
- run:
name: "Cross - build image"
command: |
docker build --progress=plain -f dockerfiles/Dockerfile.cross --tag cli-builder:$CIRCLE_BUILD_NUM .
- run:
name: "Cross"
command: |
docker build -f dockerfiles/Dockerfile.cross --tag cli-builder:$CIRCLE_BUILD_NUM .
name=cross-$CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX
docker run \
-e CROSS_GROUP=$CIRCLE_NODE_INDEX \
@ -46,18 +75,29 @@ jobs:
test:
working_directory: /work
docker: [{image: 'docker:18.03-git'}]
docker: [{image: 'docker:18.09-git'}]
environment:
DOCKER_BUILDKIT: 1
steps:
- checkout
- setup_remote_docker:
version: 18.03.1-ce
reusable: true
exclusive: false
version: 18.09.3
reusable: true
exclusive: false
- run:
name: "Docker version"
command: docker version
- run:
name: "Docker info"
command: docker info
- run:
name: "Unit Test with Coverage - build image"
command: |
mkdir -p test-results/unit-tests
docker build --progress=plain -f dockerfiles/Dockerfile.dev --tag cli-builder:$CIRCLE_BUILD_NUM .
- run:
name: "Unit Test with Coverage"
command: |
mkdir -p test-results/unit-tests
docker build -f dockerfiles/Dockerfile.dev --tag cli-builder:$CIRCLE_BUILD_NUM .
docker run \
-e GOTESTSUM_JUNITFILE=/tmp/junit.xml \
--name \
@ -82,36 +122,33 @@ jobs:
validate:
working_directory: /work
docker: [{image: 'docker:18.03-git'}]
docker: [{image: 'docker:18.09-git'}]
environment:
DOCKER_BUILDKIT: 1
steps:
- checkout
- setup_remote_docker:
version: 18.03.1-ce
reusable: true
exclusive: false
version: 18.09.3
reusable: true
exclusive: false
- run:
name: "Docker version"
command: docker version
- run:
name: "Docker info"
command: docker info
- run:
name: "Validate - build image"
command: |
rm -f .dockerignore # include .git
docker build --progress=plain -f dockerfiles/Dockerfile.dev --tag cli-builder-with-git:$CIRCLE_BUILD_NUM .
- run:
name: "Validate Vendor, Docs, and Code Generation"
command: |
rm -f .dockerignore # include .git
docker build -f dockerfiles/Dockerfile.dev --tag cli-builder-with-git:$CIRCLE_BUILD_NUM .
docker run --rm cli-builder-with-git:$CIRCLE_BUILD_NUM \
make ci-validate
no_output_timeout: 15m
shellcheck:
working_directory: /work
docker: [{image: 'docker:18.03-git'}]
steps:
- checkout
- setup_remote_docker:
version: 18.03.1-ce
reusable: true
exclusive: false
- run:
name: "Run shellcheck"
command: |
docker build -f dockerfiles/Dockerfile.shellcheck --tag cli-validator:$CIRCLE_BUILD_NUM .
docker run --rm cli-validator:$CIRCLE_BUILD_NUM \
make shellcheck
workflows:
version: 2
ci:
@ -120,4 +157,3 @@ workflows:
- cross
- test
- validate
- shellcheck

View File

@ -7,8 +7,8 @@ import (
"testing"
"github.com/spf13/cobra"
"gotest.tools/assert"
"gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
"gotest.tools/v3/assert/cmp"
)
type fakeCandidate struct {

View File

@ -25,6 +25,11 @@ func (e *pluginError) Cause() error {
return e.cause
}
// Unwrap provides compatibility for Go 1.13 error chains.
func (e *pluginError) Unwrap() error {
return e.cause
}
// MarshalText marshalls the pluginError into a textual form.
func (e *pluginError) MarshalText() (text []byte, err error) {
return []byte(e.cause.Error()), nil

View File

@ -6,7 +6,7 @@ import (
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func TestPluginError(t *testing.T) {
@ -16,7 +16,7 @@ func TestPluginError(t *testing.T) {
inner := fmt.Errorf("testing")
err = wrapAsPluginError(inner, "wrapping")
assert.Error(t, err, "wrapping: testing")
assert.Equal(t, inner, errors.Cause(err))
assert.Assert(t, errors.Is(err, inner))
actual, err := yaml.Marshal(err)
assert.NilError(t, err)

View File

@ -7,8 +7,8 @@ import (
"github.com/docker/cli/cli/config"
"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/internal/test"
"gotest.tools/assert"
"gotest.tools/fs"
"gotest.tools/v3/assert"
"gotest.tools/v3/fs"
)
func TestListPluginCandidates(t *testing.T) {

View File

@ -6,8 +6,8 @@ import (
pluginmanager "github.com/docker/cli/cli-plugins/manager"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/spf13/cobra"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestVisitAll(t *testing.T) {

View File

@ -44,8 +44,8 @@ func NewPruneCommand(dockerCli command.Cli) *cobra.Command {
flags := cmd.Flags()
flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation")
flags.BoolVarP(&options.all, "all", "a", false, "Remove all unused images, not just dangling ones")
flags.Var(&options.filter, "filter", "Provide filter values (e.g. 'unused-for=24h')")
flags.BoolVarP(&options.all, "all", "a", false, "Remove all unused build cache, not just dangling ones")
flags.Var(&options.filter, "filter", "Provide filter values (e.g. 'until=24h')")
flags.Var(&options.keepStorage, "keep-storage", "Amount of disk space to keep for cache")
return cmd

View File

@ -5,8 +5,8 @@ import (
"strings"
"testing"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestLoadFileV01Success(t *testing.T) {

View File

@ -8,8 +8,8 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestCheckpointCreateErrors(t *testing.T) {

View File

@ -6,7 +6,7 @@ import (
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/docker/api/types"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func TestCheckpointContextFormatWrite(t *testing.T) {

View File

@ -7,9 +7,9 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
func TestCheckpointListErrors(t *testing.T) {

View File

@ -7,8 +7,8 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestCheckpointRemoveErrors(t *testing.T) {

View File

@ -8,6 +8,8 @@ import (
"path/filepath"
"runtime"
"strconv"
"strings"
"time"
"github.com/docker/cli/cli/config"
cliconfig "github.com/docker/cli/cli/config"
@ -25,6 +27,7 @@ import (
"github.com/docker/cli/internal/containerizedengine"
dopts "github.com/docker/cli/opts"
clitypes "github.com/docker/cli/types"
"github.com/docker/docker/api"
"github.com/docker/docker/api/types"
registrytypes "github.com/docker/docker/api/types/registry"
"github.com/docker/docker/client"
@ -76,7 +79,7 @@ type DockerCli struct {
err io.Writer
client client.APIClient
serverInfo ServerInfo
clientInfo ClientInfo
clientInfo *ClientInfo
contentTrust bool
newContainerizeClient func(string) (clitypes.ContainerizedClient, error)
contextStore store.Store
@ -87,7 +90,7 @@ type DockerCli struct {
// DefaultVersion returns api.defaultVersion or DOCKER_API_VERSION if specified.
func (cli *DockerCli) DefaultVersion() string {
return cli.clientInfo.DefaultVersion
return cli.ClientInfo().DefaultVersion
}
// Client returns the APIClient
@ -126,9 +129,16 @@ func ShowHelp(err io.Writer) func(*cobra.Command, []string) error {
// ConfigFile returns the ConfigFile
func (cli *DockerCli) ConfigFile() *configfile.ConfigFile {
if cli.configFile == nil {
cli.loadConfigFile()
}
return cli.configFile
}
func (cli *DockerCli) loadConfigFile() {
cli.configFile = cliconfig.LoadDefaultConfigFile(cli.err)
}
// ServerInfo returns the server version details for the host this client is
// connected to
func (cli *DockerCli) ServerInfo() ServerInfo {
@ -137,7 +147,36 @@ func (cli *DockerCli) ServerInfo() ServerInfo {
// ClientInfo returns the client details for the cli
func (cli *DockerCli) ClientInfo() ClientInfo {
return cli.clientInfo
if cli.clientInfo == nil {
if err := cli.loadClientInfo(); err != nil {
panic(err)
}
}
return *cli.clientInfo
}
func (cli *DockerCli) loadClientInfo() error {
var experimentalValue string
// Environment variable always overrides configuration
if experimentalValue = os.Getenv("DOCKER_CLI_EXPERIMENTAL"); experimentalValue == "" {
experimentalValue = cli.ConfigFile().Experimental
}
hasExperimental, err := isEnabled(experimentalValue)
if err != nil {
return errors.Wrap(err, "Experimental field")
}
var v string
if cli.client != nil {
v = cli.client.ClientVersion()
} else {
v = api.DefaultVersion
}
cli.clientInfo = &ClientInfo{
DefaultVersion: v,
HasExperimental: hasExperimental,
}
return nil
}
// ContentTrustEnabled returns whether content trust has been enabled by an
@ -207,7 +246,7 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...Initialize
debug.Enable()
}
cli.configFile = cliconfig.LoadDefaultConfigFile(cli.err)
cli.loadConfigFile()
baseContextStore := store.New(cliconfig.ContextStoreDir(), cli.contextStoreConfig)
cli.contextStore = &ContextStoreWithDefault{
@ -239,20 +278,12 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...Initialize
return err
}
}
var experimentalValue string
// Environment variable always overrides configuration
if experimentalValue = os.Getenv("DOCKER_CLI_EXPERIMENTAL"); experimentalValue == "" {
experimentalValue = cli.configFile.Experimental
}
hasExperimental, err := isEnabled(experimentalValue)
if err != nil {
return errors.Wrap(err, "Experimental field")
}
cli.clientInfo = ClientInfo{
DefaultVersion: cli.client.ClientVersion(),
HasExperimental: hasExperimental,
}
cli.initializeFromClient()
if err := cli.loadClientInfo(); err != nil {
return err
}
return nil
}
@ -343,7 +374,16 @@ func isEnabled(value string) (bool, error) {
}
func (cli *DockerCli) initializeFromClient() {
ping, err := cli.client.Ping(context.Background())
ctx := context.Background()
if strings.HasPrefix(cli.DockerEndpoint().Host, "tcp://") {
// @FIXME context.WithTimeout doesn't work with connhelper / ssh connections
// time="2020-04-10T10:16:26Z" level=warning msg="commandConn.CloseWrite: commandconn: failed to wait: signal: killed"
var cancel func()
ctx, cancel = context.WithTimeout(ctx, 2*time.Second)
defer cancel()
}
ping, err := cli.client.Ping(ctx)
if err != nil {
// Default to true if we fail to connect to daemon
cli.serverInfo = ServerInfo{HasExperimental: true}

View File

@ -4,7 +4,7 @@ import (
"os"
"testing"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func contentTrustEnabled(t *testing.T) bool {

View File

@ -6,6 +6,7 @@ import (
"crypto/x509"
"fmt"
"io/ioutil"
"net/http"
"os"
"runtime"
"testing"
@ -18,10 +19,10 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/env"
"gotest.tools/fs"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/env"
"gotest.tools/v3/fs"
)
func TestNewAPIClientFromFlags(t *testing.T) {
@ -79,6 +80,24 @@ func TestNewAPIClientFromFlagsWithAPIVersionFromEnv(t *testing.T) {
assert.Check(t, is.Equal(customVersion, apiclient.ClientVersion()))
}
func TestNewAPIClientFromFlagsWithHttpProxyEnv(t *testing.T) {
defer env.Patch(t, "HTTP_PROXY", "http://proxy.acme.com:1234")()
defer env.Patch(t, "DOCKER_HOST", "tcp://docker.acme.com:2376")()
opts := &flags.CommonOptions{}
configFile := &configfile.ConfigFile{}
apiclient, err := NewAPIClientFromFlags(opts, configFile)
assert.NilError(t, err)
transport, ok := apiclient.HTTPClient().Transport.(*http.Transport)
assert.Assert(t, ok)
assert.Assert(t, transport.Proxy != nil)
request, err := http.NewRequest(http.MethodGet, "tcp://docker.acme.com:2376", nil)
assert.NilError(t, err)
url, err := transport.Proxy(request)
assert.NilError(t, err)
assert.Check(t, is.Equal("http://proxy.acme.com:1234", url.String()))
}
type fakeClient struct {
client.Client
pingFunc func() (types.Ping, error)
@ -133,6 +152,7 @@ func TestInitializeFromClient(t *testing.T) {
}
for _, testcase := range testcases {
testcase := testcase
t.Run(testcase.doc, func(t *testing.T) {
apiclient := &fakeClient{
pingFunc: testcase.pingFunc,
@ -170,6 +190,7 @@ func TestExperimentalCLI(t *testing.T) {
}
for _, testcase := range testcases {
testcase := testcase
t.Run(testcase.doc, func(t *testing.T) {
dir := fs.NewDir(t, testcase.doc, fs.WithFile("config.json", testcase.configfile))
defer dir.Remove()
@ -223,6 +244,7 @@ func TestGetClientWithPassword(t *testing.T) {
}
for _, testcase := range testcases {
testcase := testcase
t.Run(testcase.doc, func(t *testing.T) {
passRetriever := func(_, _ string, _ bool, attempts int) (passphrase string, giveup bool, err error) {
// Always return an invalid pass first to test iteration
@ -275,11 +297,12 @@ func TestNewDockerCliAndOperators(t *testing.T) {
inbuf := bytes.NewBuffer([]byte("input"))
outbuf := bytes.NewBuffer(nil)
errbuf := bytes.NewBuffer(nil)
cli.Apply(
err = cli.Apply(
WithInputStream(ioutil.NopCloser(inbuf)),
WithOutputStream(outbuf),
WithErrorStream(errbuf),
)
assert.NilError(t, err)
// Check input stream
inputStream, err := ioutil.ReadAll(cli.In())
assert.NilError(t, err)

View File

@ -11,9 +11,9 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
const configDataFile = "config-create-with-name.golden"

View File

@ -7,8 +7,8 @@ import (
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/docker/api/types/swarm"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestConfigContextFormatWrite(t *testing.T) {

View File

@ -7,12 +7,11 @@ import (
"time"
"github.com/docker/cli/internal/test"
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
"github.com/docker/docker/api/types/swarm"
"github.com/pkg/errors"
// Import builders to get the builder function as package function
. "github.com/docker/cli/internal/test/builders"
"gotest.tools/assert"
"gotest.tools/golden"
"gotest.tools/v3/assert"
"gotest.tools/v3/golden"
)
func TestConfigInspectErrors(t *testing.T) {

View File

@ -7,14 +7,13 @@ import (
"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/internal/test"
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/pkg/errors"
// Import builders to get the builder function as package function
. "github.com/docker/cli/internal/test/builders"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
func TestConfigListErrors(t *testing.T) {

View File

@ -7,8 +7,8 @@ import (
"github.com/docker/cli/internal/test"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestConfigRemoveErrors(t *testing.T) {

View File

@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
"net/http/httputil"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
@ -103,10 +102,7 @@ func runAttach(dockerCli command.Cli, opts *attachOptions) error {
}
resp, errAttach := client.ContainerAttach(ctx, opts.container, options)
if errAttach != nil && errAttach != httputil.ErrPersistEOF {
// ContainerAttach returns an ErrPersistEOF (connection closed)
// means server met an error and put it in Hijacked connection
// keep the error and read detailed error message from hijacked connection later
if errAttach != nil {
return errAttach
}
defer resp.Close()
@ -142,10 +138,6 @@ func runAttach(dockerCli command.Cli, opts *attachOptions) error {
return err
}
if errAttach != nil {
return errAttach
}
return getExitStatus(errC, resultC)
}

View File

@ -10,7 +10,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/pkg/errors"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func TestNewAttachCommandErrors(t *testing.T) {

View File

@ -11,10 +11,10 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/archive"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/fs"
"gotest.tools/skip"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/fs"
"gotest.tools/v3/skip"
)
func TestRunCopyWithInvalidArguments(t *testing.T) {

View File

@ -19,10 +19,10 @@ import (
"github.com/docker/docker/api/types/network"
"github.com/google/go-cmp/cmp"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/fs"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/fs"
"gotest.tools/v3/golden"
)
func TestCIDFileNoOPWithNoFilename(t *testing.T) {
@ -151,6 +151,7 @@ func TestNewCreateCommandWithContentTrustErrors(t *testing.T) {
},
}
for _, tc := range testCases {
tc := tc
cli := test.NewFakeCli(&fakeClient{
createContainerFunc: func(config *container.Config,
hostConfig *container.HostConfig,
@ -209,6 +210,7 @@ func TestNewCreateCommandWithWarnings(t *testing.T) {
},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{
createContainerFunc: func(config *container.Config,

View File

@ -11,8 +11,8 @@ import (
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func withDefaultOpts(options execOptions) execOptions {

View File

@ -7,8 +7,8 @@ import (
"testing"
"github.com/docker/cli/internal/test"
"gotest.tools/assert"
"gotest.tools/fs"
"gotest.tools/v3/assert"
"gotest.tools/v3/fs"
)
func TestContainerExportOutputToFile(t *testing.T) {

View File

@ -7,8 +7,8 @@ import (
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/pkg/archive"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestDiffContextFormatWrite(t *testing.T) {

View File

@ -6,8 +6,8 @@ import (
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/docker/pkg/stringid"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestContainerStatsContext(t *testing.T) {

View File

@ -7,11 +7,10 @@ import (
"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/internal/test"
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
"github.com/docker/docker/api/types"
// Import builders to get the builder function as package function
. "github.com/docker/cli/internal/test/builders"
"gotest.tools/assert"
"gotest.tools/golden"
"gotest.tools/v3/assert"
"gotest.tools/v3/golden"
)
func TestContainerListErrors(t *testing.T) {

View File

@ -9,8 +9,8 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
var logFn = func(expectedOut string) func(string, types.ContainerLogsOptions) (io.ReadCloser, error) {

View File

@ -799,7 +799,7 @@ func parsePortOpts(publishOpts []string) ([]string, error) {
params[opt[0]] = opt[1]
}
optsList = append(optsList, fmt.Sprintf("%s:%s/%s", params["target"], params["published"], params["protocol"]))
optsList = append(optsList, fmt.Sprintf("%s:%s/%s", params["published"], params["target"], params["protocol"]))
}
return optsList, nil
}

View File

@ -14,9 +14,9 @@ import (
"github.com/docker/go-connections/nat"
"github.com/pkg/errors"
"github.com/spf13/pflag"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/skip"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/skip"
)
func TestValidateAttach(t *testing.T) {
@ -65,7 +65,7 @@ func setupRunFlags() (*pflag.FlagSet, *containerOptions) {
}
func parseMustError(t *testing.T, args string) {
_, _, _, err := parseRun(strings.Split(args+" ubuntu bash", " "))
_, _, _, err := parseRun(strings.Split(args+" ubuntu bash", " ")) //nolint:dogsled
assert.ErrorContains(t, err, "", args)
}
@ -539,7 +539,7 @@ func TestParseModes(t *testing.T) {
}
// uts ko
_, _, _, err = parseRun([]string{"--uts=container:", "img", "cmd"})
_, _, _, err = parseRun([]string{"--uts=container:", "img", "cmd"}) //nolint:dogsled
assert.ErrorContains(t, err, "--uts: invalid UTS mode")
// uts ok
@ -600,7 +600,7 @@ func TestParseRestartPolicy(t *testing.T) {
func TestParseRestartPolicyAutoRemove(t *testing.T) {
expected := "Conflicting options: --restart and --rm"
_, _, _, err := parseRun([]string{"--rm", "--restart=always", "img", "cmd"})
_, _, _, err := parseRun([]string{"--rm", "--restart=always", "img", "cmd"}) //nolint:dogsled
if err == nil || err.Error() != expected {
t.Fatalf("Expected error %v, but got none", expected)
}
@ -854,3 +854,9 @@ func TestParseSystemPaths(t *testing.T) {
assert.DeepEqual(t, readonlyPaths, tc.readonly)
}
}
func TestParsePortOpts(t *testing.T) {
parsed, err := parsePortOpts([]string{"published=1500,target=200", "target=80,published=90"})
assert.NilError(t, err)
assert.DeepEqual(t, []string{"1500:200/tcp", "90:80/tcp"}, parsed)
}

View File

@ -4,8 +4,8 @@ import (
"testing"
"github.com/docker/cli/opts"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestBuildContainerListOptions(t *testing.T) {

View File

@ -35,7 +35,7 @@ func NewRmCommand(dockerCli command.Cli) *cobra.Command {
}
flags := cmd.Flags()
flags.BoolVarP(&opts.rmVolumes, "volumes", "v", false, "Remove the volumes associated with the container")
flags.BoolVarP(&opts.rmVolumes, "volumes", "v", false, "Remove anonymous volumes associated with the container")
flags.BoolVarP(&opts.rmLink, "link", "l", false, "Remove the specified link")
flags.BoolVarP(&opts.force, "force", "f", false, "Force the removal of a running container (uses SIGKILL)")
return cmd

View File

@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
"net/http/httputil"
"os"
"runtime"
"strings"
@ -115,11 +114,6 @@ func runContainer(dockerCli command.Cli, opts *runOptions, copts *containerOptio
config.StdinOnce = false
}
// Disable sigProxy when in TTY mode
if config.Tty {
opts.sigProxy = false
}
// Telling the Windows daemon the initial size of the tty during start makes
// a far better user experience rather than relying on subsequent resizes
// to cause things to catch up.
@ -253,10 +247,7 @@ func attachContainer(
}
resp, errAttach := dockerCli.Client().ContainerAttach(ctx, containerID, options)
if errAttach != nil && errAttach != httputil.ErrPersistEOF {
// ContainerAttach returns an ErrPersistEOF (connection closed)
// means server met an error and put it in Hijacked connection
// keep the error and read detailed error message from hijacked connection later
if errAttach != nil {
return nil, errAttach
}

View File

@ -9,8 +9,8 @@ import (
"github.com/docker/cli/internal/test/notary"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestRunLabel(t *testing.T) {

View File

@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
"net/http/httputil"
"strings"
"github.com/docker/cli/cli"
@ -98,10 +97,7 @@ func runStart(dockerCli command.Cli, opts *startOptions) error {
}
resp, errAttach := dockerCli.Client().ContainerAttach(ctx, c.ID, options)
if errAttach != nil && errAttach != httputil.ErrPersistEOF {
// ContainerAttach return an ErrPersistEOF (connection closed)
// means server met an error and already put it in Hijacked connection,
// we would keep the error and read the detailed error message from hijacked connection
if errAttach != nil {
return errAttach
}
defer resp.Close()
@ -154,7 +150,7 @@ func runStart(dockerCli command.Cli, opts *startOptions) error {
}
}
if attachErr := <-cErr; attachErr != nil {
if _, ok := err.(term.EscapeError); ok {
if _, ok := attachErr.(term.EscapeError); ok {
// The user entered the detach escape sequence.
return nil
}

View File

@ -208,7 +208,9 @@ func runStats(dockerCli command.Cli, opts *statsOptions) error {
}
var err error
for range time.Tick(500 * time.Millisecond) {
ticker := time.NewTicker(500 * time.Millisecond)
defer ticker.Stop()
for range ticker.C {
cleanScreen()
ccstats := []StatsEntry{}
cStats.mu.Lock()

View File

@ -5,7 +5,7 @@ import (
"testing"
"github.com/docker/docker/api/types"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func TestCalculateMemUsageUnixNoCache(t *testing.T) {

View File

@ -9,8 +9,8 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestInitTtySizeErrors(t *testing.T) {

View File

@ -9,8 +9,8 @@ import (
"github.com/docker/docker/api"
"github.com/docker/docker/api/types/container"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func waitFn(cid string) (<-chan container.ContainerWaitOKBody, <-chan error) {

View File

@ -78,13 +78,19 @@ func RunCreate(cli command.Cli, o *CreateOptions) error {
if err != nil {
return errors.Wrap(err, "unable to parse default-stack-orchestrator")
}
if o.From == "" && o.Docker == nil && o.Kubernetes == nil {
return createFromExistingContext(s, cli.CurrentContext(), stackOrchestrator, o)
switch {
case o.From == "" && o.Docker == nil && o.Kubernetes == nil:
err = createFromExistingContext(s, cli.CurrentContext(), stackOrchestrator, o)
case o.From != "":
err = createFromExistingContext(s, o.From, stackOrchestrator, o)
default:
err = createNewContext(o, stackOrchestrator, cli, s)
}
if o.From != "" {
return createFromExistingContext(s, o.From, stackOrchestrator, o)
if err == nil {
fmt.Fprintln(cli.Out(), o.Name)
fmt.Fprintf(cli.Err(), "Successfully created context %q\n", o.Name)
}
return createNewContext(o, stackOrchestrator, cli, s)
return err
}
func createNewContext(o *CreateOptions, stackOrchestrator command.Orchestrator, cli command.Cli, s store.Writer) error {
@ -127,8 +133,6 @@ func createNewContext(o *CreateOptions, stackOrchestrator command.Orchestrator,
if err := s.ResetTLSMaterial(o.Name, &contextTLSData); err != nil {
return err
}
fmt.Fprintln(cli.Out(), o.Name)
fmt.Fprintf(cli.Err(), "Successfully created context %q\n", o.Name)
return nil
}

View File

@ -1,6 +1,7 @@
package context
import (
"fmt"
"io/ioutil"
"os"
"testing"
@ -11,8 +12,8 @@ import (
"github.com/docker/cli/cli/context/kubernetes"
"github.com/docker/cli/cli/context/store"
"github.com/docker/cli/internal/test"
"gotest.tools/assert"
"gotest.tools/env"
"gotest.tools/v3/assert"
"gotest.tools/v3/env"
)
func makeFakeCli(t *testing.T, opts ...func(*test.FakeCli)) (*test.FakeCli, func()) {
@ -131,6 +132,11 @@ func TestCreateInvalids(t *testing.T) {
}
}
func assertContextCreateLogging(t *testing.T, cli *test.FakeCli, n string) {
assert.Equal(t, n+"\n", cli.OutBuffer().String())
assert.Equal(t, fmt.Sprintf("Successfully created context %q\n", n), cli.ErrBuffer().String())
}
func TestCreateOrchestratorSwarm(t *testing.T) {
cli, cleanup := makeFakeCli(t)
defer cleanup()
@ -141,8 +147,7 @@ func TestCreateOrchestratorSwarm(t *testing.T) {
Docker: map[string]string{},
})
assert.NilError(t, err)
assert.Equal(t, "test\n", cli.OutBuffer().String())
assert.Equal(t, "Successfully created context \"test\"\n", cli.ErrBuffer().String())
assertContextCreateLogging(t, cli, "test")
}
func TestCreateOrchestratorEmpty(t *testing.T) {
@ -154,6 +159,7 @@ func TestCreateOrchestratorEmpty(t *testing.T) {
Docker: map[string]string{},
})
assert.NilError(t, err)
assertContextCreateLogging(t, cli, "test")
}
func validateTestKubeEndpoint(t *testing.T, s store.Reader, name string) {
@ -189,6 +195,7 @@ func TestCreateOrchestratorAllKubernetesEndpointFromCurrent(t *testing.T) {
cli, cleanup := makeFakeCli(t)
defer cleanup()
createTestContextWithKube(t, cli)
assertContextCreateLogging(t, cli, "test")
validateTestKubeEndpoint(t, cli.ContextStore(), "test")
}
@ -225,6 +232,7 @@ func TestCreateFromContext(t *testing.T) {
defer cleanup()
revert := env.Patch(t, "KUBECONFIG", "./testdata/test-kubeconfig")
defer revert()
cli.ResetOutputBuffers()
assert.NilError(t, RunCreate(cli, &CreateOptions{
Name: "original",
Description: "original description",
@ -236,6 +244,9 @@ func TestCreateFromContext(t *testing.T) {
},
DefaultStackOrchestrator: "swarm",
}))
assertContextCreateLogging(t, cli, "original")
cli.ResetOutputBuffers()
assert.NilError(t, RunCreate(cli, &CreateOptions{
Name: "dummy",
Description: "dummy description",
@ -247,11 +258,14 @@ func TestCreateFromContext(t *testing.T) {
},
DefaultStackOrchestrator: "swarm",
}))
assertContextCreateLogging(t, cli, "dummy")
cli.SetCurrentContext("dummy")
for _, c := range cases {
c := c
t.Run(c.name, func(t *testing.T) {
cli.ResetOutputBuffers()
err := RunCreate(cli, &CreateOptions{
From: "original",
Name: c.name,
@ -261,6 +275,7 @@ func TestCreateFromContext(t *testing.T) {
Kubernetes: c.kubernetes,
})
assert.NilError(t, err)
assertContextCreateLogging(t, cli, c.name)
newContext, err := cli.ContextStore().GetMetadata(c.name)
assert.NilError(t, err)
newContextTyped, err := command.GetDockerContext(newContext)
@ -308,6 +323,7 @@ func TestCreateFromCurrent(t *testing.T) {
defer cleanup()
revert := env.Patch(t, "KUBECONFIG", "./testdata/test-kubeconfig")
defer revert()
cli.ResetOutputBuffers()
assert.NilError(t, RunCreate(cli, &CreateOptions{
Name: "original",
Description: "original description",
@ -319,17 +335,21 @@ func TestCreateFromCurrent(t *testing.T) {
},
DefaultStackOrchestrator: "swarm",
}))
assertContextCreateLogging(t, cli, "original")
cli.SetCurrentContext("original")
for _, c := range cases {
c := c
t.Run(c.name, func(t *testing.T) {
cli.ResetOutputBuffers()
err := RunCreate(cli, &CreateOptions{
Name: c.name,
Description: c.description,
DefaultStackOrchestrator: c.orchestrator,
})
assert.NilError(t, err)
assertContextCreateLogging(t, cli, c.name)
newContext, err := cli.ContextStore().GetMetadata(c.name)
assert.NilError(t, err)
newContextTyped, err := command.GetDockerContext(newContext)

View File

@ -9,7 +9,7 @@ import (
"testing"
"github.com/docker/cli/cli/streams"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func TestExportImportWithFile(t *testing.T) {

View File

@ -4,8 +4,8 @@ import (
"strings"
"testing"
"gotest.tools/assert"
"gotest.tools/golden"
"gotest.tools/v3/assert"
"gotest.tools/v3/golden"
)
func TestInspect(t *testing.T) {

View File

@ -4,9 +4,9 @@ import (
"testing"
"github.com/docker/cli/cli/command"
"gotest.tools/assert"
"gotest.tools/env"
"gotest.tools/golden"
"gotest.tools/v3/assert"
"gotest.tools/v3/env"
"gotest.tools/v3/golden"
)
func createTestContextWithKubeAndSwarm(t *testing.T, cli command.Cli, name string, orchestrator string) {

View File

@ -9,7 +9,7 @@ import (
"github.com/docker/cli/cli/config"
"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/cli/context/store"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func TestRemove(t *testing.T) {

View File

@ -6,8 +6,8 @@ import (
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/context/docker"
"github.com/docker/cli/cli/context/kubernetes"
"gotest.tools/assert"
"gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
"gotest.tools/v3/assert/cmp"
)
func TestUpdateDescriptionOnly(t *testing.T) {

View File

@ -9,7 +9,7 @@ import (
"github.com/docker/cli/cli/config"
"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/cli/context/store"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func TestUse(t *testing.T) {

View File

@ -11,9 +11,9 @@ import (
"github.com/docker/cli/cli/context/store"
cliflags "github.com/docker/cli/cli/flags"
"github.com/docker/go-connections/tlsconfig"
"gotest.tools/assert"
"gotest.tools/env"
"gotest.tools/golden"
"gotest.tools/v3/assert"
"gotest.tools/v3/env"
"gotest.tools/v3/golden"
)
type endpoint struct {

View File

@ -14,9 +14,9 @@ import (
"github.com/docker/docker/client"
"github.com/docker/licensing"
"github.com/docker/licensing/model"
"gotest.tools/assert"
"gotest.tools/fs"
"gotest.tools/golden"
"gotest.tools/v3/assert"
"gotest.tools/v3/fs"
"gotest.tools/v3/golden"
)
const (

View File

@ -12,8 +12,8 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/opencontainers/go-digest"
"gotest.tools/assert"
"gotest.tools/golden"
"gotest.tools/v3/assert"
"gotest.tools/v3/golden"
)
var (

View File

@ -3,7 +3,7 @@ package engine
import (
"testing"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func TestNewEngineCommand(t *testing.T) {

View File

@ -10,8 +10,8 @@ import (
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/cli/internal/licenseutils"
"github.com/docker/licensing/model"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestSubscriptionContextWrite(t *testing.T) {

View File

@ -8,7 +8,7 @@ import (
clitypes "github.com/docker/cli/types"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func TestUpdateNoContainerd(t *testing.T) {

View File

@ -8,8 +8,8 @@ import (
"github.com/docker/cli/cli/command/formatter"
clitypes "github.com/docker/cli/types"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestUpdateContextWrite(t *testing.T) {

View File

@ -10,9 +10,9 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/stringid"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
func TestContainerPsContext(t *testing.T) {
@ -304,7 +304,8 @@ func TestContainerContextWriteWithNoContainers(t *testing.T) {
}
for _, context := range contexts {
ContainerWrite(context.context, containers)
err := ContainerWrite(context.context, containers)
assert.NilError(t, err)
assert.Check(t, is.Equal(context.expected, out.String()))
// Clean buffer
out.Reset()

View File

@ -4,9 +4,9 @@ import (
"bytes"
"testing"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
func TestDiskUsageContextFormatWrite(t *testing.T) {

View File

@ -3,8 +3,8 @@ package formatter
import (
"testing"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestEllipsis(t *testing.T) {

View File

@ -9,8 +9,8 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/stringid"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestImageContext(t *testing.T) {
@ -348,7 +348,8 @@ func TestImageContextWriteWithNoImage(t *testing.T) {
}
for _, context := range contexts {
ImageWrite(context.context, images)
err := ImageWrite(context.context, images)
assert.NilError(t, err)
assert.Check(t, is.Equal(context.expected, out.String()))
// Clean buffer
out.Reset()

View File

@ -9,8 +9,8 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/stringid"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestVolumeContext(t *testing.T) {

View File

@ -1,16 +1,14 @@
package idresolver
import (
"context"
"testing"
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
"github.com/docker/docker/api/types/swarm"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
// Import builders to get the builder function as package function
"context"
. "github.com/docker/cli/internal/test/builders"
"github.com/pkg/errors"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestResolveError(t *testing.T) {

View File

@ -115,33 +115,64 @@ func NewBuildCommand(dockerCli command.Cli) *cobra.Command {
},
}
// Wrap the global pre-run to handle non-BuildKit use of the --platform flag.
//
// We're doing it here so that we're only contacting the daemon when actually
// running the command, and not during initialization.
// TODO remove this hack once we no longer support the experimental use of --platform
rootFn := cmd.Root().PersistentPreRunE
cmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
if ok, _ := command.BuildKitEnabled(dockerCli.ServerInfo()); !ok {
f := cmd.Flag("platform")
delete(f.Annotations, "buildkit")
f.Annotations["version"] = []string{"1.32"}
f.Annotations["experimental"] = nil
}
if rootFn != nil {
return rootFn(cmd, args)
}
return nil
}
flags := cmd.Flags()
flags.VarP(&options.tags, "tag", "t", "Name and optionally a tag in the 'name:tag' format")
flags.Var(&options.buildArgs, "build-arg", "Set build-time variables")
flags.Var(options.ulimits, "ulimit", "Ulimit options")
flags.SetAnnotation("ulimit", "no-buildkit", nil)
flags.StringVarP(&options.dockerfileName, "file", "f", "", "Name of the Dockerfile (Default is 'PATH/Dockerfile')")
flags.VarP(&options.memory, "memory", "m", "Memory limit")
flags.SetAnnotation("memory", "no-buildkit", nil)
flags.Var(&options.memorySwap, "memory-swap", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap")
flags.SetAnnotation("memory-swap", "no-buildkit", nil)
flags.Var(&options.shmSize, "shm-size", "Size of /dev/shm")
flags.SetAnnotation("shm-size", "no-buildkit", nil)
flags.Int64VarP(&options.cpuShares, "cpu-shares", "c", 0, "CPU shares (relative weight)")
flags.SetAnnotation("cpu-shares", "no-buildkit", nil)
flags.Int64Var(&options.cpuPeriod, "cpu-period", 0, "Limit the CPU CFS (Completely Fair Scheduler) period")
flags.SetAnnotation("cpu-period", "no-buildkit", nil)
flags.Int64Var(&options.cpuQuota, "cpu-quota", 0, "Limit the CPU CFS (Completely Fair Scheduler) quota")
flags.SetAnnotation("cpu-quota", "no-buildkit", nil)
flags.StringVar(&options.cpuSetCpus, "cpuset-cpus", "", "CPUs in which to allow execution (0-3, 0,1)")
flags.SetAnnotation("cpuset-cpus", "no-buildkit", nil)
flags.StringVar(&options.cpuSetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)")
flags.SetAnnotation("cpuset-mems", "no-buildkit", nil)
flags.StringVar(&options.cgroupParent, "cgroup-parent", "", "Optional parent cgroup for the container")
flags.SetAnnotation("cgroup-parent", "no-buildkit", nil)
flags.StringVar(&options.isolation, "isolation", "", "Container isolation technology")
flags.Var(&options.labels, "label", "Set metadata for an image")
flags.BoolVar(&options.noCache, "no-cache", false, "Do not use cache when building the image")
flags.BoolVar(&options.rm, "rm", true, "Remove intermediate containers after a successful build")
flags.SetAnnotation("rm", "no-buildkit", nil)
flags.BoolVar(&options.forceRm, "force-rm", false, "Always remove intermediate containers")
flags.SetAnnotation("force-rm", "no-buildkit", nil)
flags.BoolVarP(&options.quiet, "quiet", "q", false, "Suppress the build output and print image ID on success")
flags.BoolVar(&options.pull, "pull", false, "Always attempt to pull a newer version of the image")
flags.StringSliceVar(&options.cacheFrom, "cache-from", []string{}, "Images to consider as cache sources")
flags.BoolVar(&options.compress, "compress", false, "Compress the build context using gzip")
flags.SetAnnotation("compress", "no-buildkit", nil)
flags.StringSliceVar(&options.securityOpt, "security-opt", []string{}, "Security options")
flags.SetAnnotation("security-opt", "no-buildkit", nil)
flags.StringVar(&options.networkMode, "network", "default", "Set the networking mode for the RUN instructions during build")
flags.SetAnnotation("network", "version", []string{"1.25"})
flags.Var(&options.extraHosts, "add-host", "Add a custom host-to-IP mapping (host:ip)")
@ -151,14 +182,8 @@ func NewBuildCommand(dockerCli command.Cli) *cobra.Command {
command.AddTrustVerificationFlags(flags, &options.untrusted, dockerCli.ContentTrustEnabled())
flags.StringVar(&options.platform, "platform", os.Getenv("DOCKER_DEFAULT_PLATFORM"), "Set platform if server is multi-platform capable")
// Platform is not experimental when BuildKit is used
buildkitEnabled, err := command.BuildKitEnabled(dockerCli.ServerInfo())
if err == nil && buildkitEnabled {
flags.SetAnnotation("platform", "version", []string{"1.38"})
} else {
flags.SetAnnotation("platform", "version", []string{"1.32"})
flags.SetAnnotation("platform", "experimental", nil)
}
flags.SetAnnotation("platform", "version", []string{"1.38"})
flags.SetAnnotation("platform", "buildkit", nil)
flags.BoolVar(&options.squash, "squash", false, "Squash newly built layers into a single new layer")
flags.SetAnnotation("squash", "experimental", nil)
@ -474,7 +499,7 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
// should be just the image ID and we'll print that to stdout.
if options.quiet {
imageID = fmt.Sprintf("%s", buildBuff)
fmt.Fprintf(dockerCli.Out(), imageID)
_, _ = fmt.Fprint(dockerCli.Out(), imageID)
}
if options.imageIDFile != "" {

View File

@ -232,6 +232,7 @@ func GetContextFromURL(out io.Writer, remoteURL, dockerfileName string) (io.Read
// getWithStatusError does an http.Get() and returns an error if the
// status code is 4xx or 5xx.
func getWithStatusError(url string) (resp *http.Response, err error) {
// #nosec G107
if resp, err = http.Get(url); err != nil {
return nil, err
}
@ -242,9 +243,9 @@ func getWithStatusError(url string) (resp *http.Response, err error) {
body, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
return nil, errors.Wrapf(err, msg+": error reading body")
return nil, errors.Wrapf(err, "%s: error reading body", msg)
}
return nil, errors.Errorf(msg+": %s", bytes.TrimSpace(body))
return nil, errors.Errorf("%s: %s", msg, bytes.TrimSpace(body))
}
// GetContextFromLocalDir uses the given local directory as context for a
@ -344,7 +345,6 @@ func getDockerfileRelPath(absContextDir, givenDockerfile string) (string, error)
absDockerfile, err = filepath.EvalSymlinks(absDockerfile)
if err != nil {
return "", errors.Errorf("unable to evaluate symlinks in Dockerfile path: %v", err)
}
}

View File

@ -13,8 +13,8 @@ import (
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/fileutils"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
const dockerfileContents = "FROM busybox"
@ -24,12 +24,12 @@ var prepareEmpty = func(t *testing.T) (string, func()) {
}
var prepareNoFiles = func(t *testing.T) (string, func()) {
return createTestTempDir(t, "", "builder-context-test")
return createTestTempDir(t, "builder-context-test")
}
var prepareOneFile = func(t *testing.T) (string, func()) {
contextDir, cleanup := createTestTempDir(t, "", "builder-context-test")
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents, 0777)
contextDir, cleanup := createTestTempDir(t, "builder-context-test")
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents)
return contextDir, cleanup
}
@ -42,7 +42,7 @@ func testValidateContextDirectory(t *testing.T, prepare func(t *testing.T) (stri
}
func TestGetContextFromLocalDirNoDockerfile(t *testing.T) {
contextDir, cleanup := createTestTempDir(t, "", "builder-context-test")
contextDir, cleanup := createTestTempDir(t, "builder-context-test")
defer cleanup()
_, _, err := GetContextFromLocalDir(contextDir, "")
@ -50,7 +50,7 @@ func TestGetContextFromLocalDirNoDockerfile(t *testing.T) {
}
func TestGetContextFromLocalDirNotExistingDir(t *testing.T) {
contextDir, cleanup := createTestTempDir(t, "", "builder-context-test")
contextDir, cleanup := createTestTempDir(t, "builder-context-test")
defer cleanup()
fakePath := filepath.Join(contextDir, "fake")
@ -60,7 +60,7 @@ func TestGetContextFromLocalDirNotExistingDir(t *testing.T) {
}
func TestGetContextFromLocalDirNotExistingDockerfile(t *testing.T) {
contextDir, cleanup := createTestTempDir(t, "", "builder-context-test")
contextDir, cleanup := createTestTempDir(t, "builder-context-test")
defer cleanup()
fakePath := filepath.Join(contextDir, "fake")
@ -70,10 +70,10 @@ func TestGetContextFromLocalDirNotExistingDockerfile(t *testing.T) {
}
func TestGetContextFromLocalDirWithNoDirectory(t *testing.T) {
contextDir, dirCleanup := createTestTempDir(t, "", "builder-context-test")
contextDir, dirCleanup := createTestTempDir(t, "builder-context-test")
defer dirCleanup()
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents, 0777)
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents)
chdirCleanup := chdir(t, contextDir)
defer chdirCleanup()
@ -86,10 +86,10 @@ func TestGetContextFromLocalDirWithNoDirectory(t *testing.T) {
}
func TestGetContextFromLocalDirWithDockerfile(t *testing.T) {
contextDir, cleanup := createTestTempDir(t, "", "builder-context-test")
contextDir, cleanup := createTestTempDir(t, "builder-context-test")
defer cleanup()
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents, 0777)
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents)
absContextDir, relDockerfile, err := GetContextFromLocalDir(contextDir, "")
assert.NilError(t, err)
@ -99,11 +99,11 @@ func TestGetContextFromLocalDirWithDockerfile(t *testing.T) {
}
func TestGetContextFromLocalDirLocalFile(t *testing.T) {
contextDir, cleanup := createTestTempDir(t, "", "builder-context-test")
contextDir, cleanup := createTestTempDir(t, "builder-context-test")
defer cleanup()
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents, 0777)
testFilename := createTestTempFile(t, contextDir, "tmpTest", "test", 0777)
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents)
testFilename := createTestTempFile(t, contextDir, "tmpTest", "test")
absContextDir, relDockerfile, err := GetContextFromLocalDir(testFilename, "")
@ -121,13 +121,13 @@ func TestGetContextFromLocalDirLocalFile(t *testing.T) {
}
func TestGetContextFromLocalDirWithCustomDockerfile(t *testing.T) {
contextDir, cleanup := createTestTempDir(t, "", "builder-context-test")
contextDir, cleanup := createTestTempDir(t, "builder-context-test")
defer cleanup()
chdirCleanup := chdir(t, contextDir)
defer chdirCleanup()
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents, 0777)
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents)
absContextDir, relDockerfile, err := GetContextFromLocalDir(contextDir, DefaultDockerfileName)
assert.NilError(t, err)
@ -173,10 +173,10 @@ func TestGetContextFromReaderString(t *testing.T) {
}
func TestGetContextFromReaderTar(t *testing.T) {
contextDir, cleanup := createTestTempDir(t, "", "builder-context-test")
contextDir, cleanup := createTestTempDir(t, "builder-context-test")
defer cleanup()
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents, 0777)
createTestTempFile(t, contextDir, DefaultDockerfileName, dockerfileContents)
tarStream, err := archive.Tar(contextDir, archive.Uncompressed)
assert.NilError(t, err)
@ -241,17 +241,18 @@ func TestValidateContextDirectoryWithOneFileExcludes(t *testing.T) {
// createTestTempDir creates a temporary directory for testing.
// It returns the created path and a cleanup function which is meant to be used as deferred call.
// When an error occurs, it terminates the test.
func createTestTempDir(t *testing.T, dir, prefix string) (string, func()) {
path, err := ioutil.TempDir(dir, prefix)
//nolint: unparam
func createTestTempDir(t *testing.T, prefix string) (string, func()) {
path, err := ioutil.TempDir("", prefix)
assert.NilError(t, err)
return path, func() { assert.NilError(t, os.RemoveAll(path)) }
}
// createTestTempFile creates a temporary file within dir with specific contents and permissions.
// When an error occurs, it terminates the test
func createTestTempFile(t *testing.T, dir, filename, contents string, perm os.FileMode) string {
func createTestTempFile(t *testing.T, dir, filename, contents string) string {
filePath := filepath.Join(dir, filename)
err := ioutil.WriteFile(filePath, []byte(contents), perm)
err := ioutil.WriteFile(filePath, []byte(contents), 0777)
assert.NilError(t, err)
return filePath
}

View File

@ -156,7 +156,8 @@ func runBuildBuildKit(dockerCli command.Cli, options buildOptions) error {
}
w = f
}
s.Allow(filesync.NewFSSyncTarget(w))
output := func(map[string]string) (io.WriteCloser, error) { return w, nil }
s.Allow(filesync.NewFSSyncTarget(output))
}
}
@ -475,16 +476,13 @@ func parseSecret(value string) (*secretsprovider.FileSource, error) {
func parseSSHSpecs(sl []string) (session.Attachable, error) {
configs := make([]sshprovider.AgentConfig, 0, len(sl))
for _, v := range sl {
c, err := parseSSH(v)
if err != nil {
return nil, err
}
c := parseSSH(v)
configs = append(configs, *c)
}
return sshprovider.NewSSHAgentProvider(configs)
}
func parseSSH(value string) (*sshprovider.AgentConfig, error) {
func parseSSH(value string) *sshprovider.AgentConfig {
parts := strings.SplitN(value, "=", 2)
cfg := sshprovider.AgentConfig{
ID: parts[0],
@ -492,5 +490,5 @@ func parseSSH(value string) (*sshprovider.AgentConfig, error) {
if len(parts) > 1 {
cfg.Paths = strings.Split(parts[1], ",")
}
return &cfg, nil
return &cfg
}

View File

@ -35,16 +35,13 @@ func isSessionSupported(dockerCli command.Cli, forStream bool) bool {
}
func trySession(dockerCli command.Cli, contextDir string, forStream bool) (*session.Session, error) {
var s *session.Session
if isSessionSupported(dockerCli, forStream) {
sharedKey, err := getBuildSharedKey(contextDir)
if err != nil {
return nil, errors.Wrap(err, "failed to get build shared key")
}
s, err = session.NewSession(context.Background(), filepath.Base(contextDir), sharedKey)
if err != nil {
return nil, errors.Wrap(err, "failed to create session")
}
if !isSessionSupported(dockerCli, forStream) {
return nil, nil
}
sharedKey := getBuildSharedKey(contextDir)
s, err := session.NewSession(context.Background(), filepath.Base(contextDir), sharedKey)
if err != nil {
return nil, errors.Wrap(err, "failed to create session")
}
return s, nil
}
@ -130,10 +127,10 @@ func (bw *bufferedWriter) String() string {
return fmt.Sprintf("%s", bw.Writer)
}
func getBuildSharedKey(dir string) (string, error) {
func getBuildSharedKey(dir string) string {
// build session is hash of build dir with node based randomness
s := sha256.Sum256([]byte(fmt.Sprintf("%s:%s", tryNodeIdentifier(), dir)))
return hex.EncodeToString(s[:]), nil
return hex.EncodeToString(s[:])
}
func tryNodeIdentifier() string {

View File

@ -19,12 +19,14 @@ import (
"github.com/docker/docker/pkg/archive"
"github.com/google/go-cmp/cmp"
"github.com/moby/buildkit/session/secrets/secretsprovider"
"gotest.tools/assert"
"gotest.tools/fs"
"gotest.tools/skip"
"gotest.tools/v3/assert"
"gotest.tools/v3/env"
"gotest.tools/v3/fs"
"gotest.tools/v3/skip"
)
func TestRunBuildDockerfileFromStdinWithCompress(t *testing.T) {
defer env.Patch(t, "DOCKER_BUILDKIT", "0")()
buffer := new(bytes.Buffer)
fakeBuild := newFakeBuild()
fakeImageBuild := func(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) {
@ -60,6 +62,7 @@ func TestRunBuildDockerfileFromStdinWithCompress(t *testing.T) {
}
func TestRunBuildResetsUidAndGidInContext(t *testing.T) {
defer env.Patch(t, "DOCKER_BUILDKIT", "0")()
skip.If(t, os.Getuid() != 0, "root is required to chown files")
fakeBuild := newFakeBuild()
cli := test.NewFakeCli(&fakeClient{imageBuildFunc: fakeBuild.build})
@ -90,6 +93,7 @@ func TestRunBuildResetsUidAndGidInContext(t *testing.T) {
}
func TestRunBuildDockerfileOutsideContext(t *testing.T) {
defer env.Patch(t, "DOCKER_BUILDKIT", "0")()
dir := fs.NewDir(t, t.Name(),
fs.WithFile("data", "data file"))
defer dir.Remove()
@ -122,7 +126,8 @@ COPY data /data
// TODO: test "context selection" logic directly when runBuild is refactored
// to support testing (ex: docker/cli#294)
func TestRunBuildFromGitHubSpecialCase(t *testing.T) {
cmd := NewBuildCommand(test.NewFakeCli(nil))
defer env.Patch(t, "DOCKER_BUILDKIT", "0")()
cmd := NewBuildCommand(test.NewFakeCli(&fakeClient{}))
// Clone a small repo that exists so git doesn't prompt for credentials
cmd.SetArgs([]string{"github.com/docker/for-win"})
cmd.SetOutput(ioutil.Discard)
@ -135,6 +140,7 @@ func TestRunBuildFromGitHubSpecialCase(t *testing.T) {
// starting with `github.com` takes precedence over the `github.com` special
// case.
func TestRunBuildFromLocalGitHubDir(t *testing.T) {
defer env.Patch(t, "DOCKER_BUILDKIT", "0")()
tmpDir, err := ioutil.TempDir("", "docker-build-from-local-dir-")
assert.NilError(t, err)
defer os.RemoveAll(tmpDir)
@ -154,6 +160,7 @@ func TestRunBuildFromLocalGitHubDir(t *testing.T) {
}
func TestRunBuildWithSymlinkedContext(t *testing.T) {
defer env.Patch(t, "DOCKER_BUILDKIT", "0")()
dockerfile := `
FROM alpine:3.6
RUN echo hello world

View File

@ -11,8 +11,8 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/pkg/stringid"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
type historyCase struct {

View File

@ -9,9 +9,9 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types/image"
"github.com/pkg/errors"
"gotest.tools/assert"
"gotest.tools/golden"
"gotest.tools/skip"
"gotest.tools/v3/assert"
"gotest.tools/v3/golden"
"gotest.tools/v3/skip"
)
func TestNewHistoryCommandErrors(t *testing.T) {

View File

@ -9,8 +9,8 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestNewImportCommandErrors(t *testing.T) {

View File

@ -7,9 +7,9 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
func TestNewInspectCommandErrors(t *testing.T) {

View File

@ -9,9 +9,9 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
func TestNewImagesCommandErrors(t *testing.T) {

View File

@ -10,8 +10,8 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/pkg/errors"
"gotest.tools/assert"
"gotest.tools/golden"
"gotest.tools/v3/assert"
"gotest.tools/v3/golden"
)
func TestNewLoadCommandErrors(t *testing.T) {

View File

@ -9,9 +9,9 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
func TestNewPruneCommandErrors(t *testing.T) {

View File

@ -10,9 +10,9 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/cli/internal/test/notary"
"github.com/docker/docker/api/types"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
func TestNewPullCommandErrors(t *testing.T) {
@ -50,7 +50,6 @@ func TestNewPullCommandSuccess(t *testing.T) {
testCases := []struct {
name string
args []string
flags map[string]string
expectedTag string
}{
{
@ -64,11 +63,8 @@ func TestNewPullCommandSuccess(t *testing.T) {
expectedTag: "image:latest",
},
{
name: "simple-quiet",
args: []string{"image"},
flags: map[string]string{
"quiet": "true",
},
name: "simple-quiet",
args: []string{"--quiet", "image"},
expectedTag: "image:latest",
},
}

View File

@ -9,7 +9,7 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/pkg/errors"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func TestNewPushCommandErrors(t *testing.T) {

View File

@ -8,9 +8,9 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
type notFound struct {

View File

@ -9,8 +9,8 @@ import (
"github.com/docker/cli/internal/test"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestNewSaveCommandErrors(t *testing.T) {

View File

@ -5,8 +5,8 @@ import (
"testing"
"github.com/docker/cli/internal/test"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestCliNewTagCommandErrors(t *testing.T) {

View File

@ -1,2 +1 @@
Using default tag: latest
docker.io/library/image:latest

View File

@ -10,7 +10,7 @@ import (
"github.com/theupdateframework/notary/client"
"github.com/theupdateframework/notary/passphrase"
"github.com/theupdateframework/notary/trustpinning"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func unsetENV() {

View File

@ -6,8 +6,8 @@ import (
"testing"
"github.com/docker/cli/templates"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
type testElement struct {

View File

@ -5,9 +5,9 @@ import (
"testing"
"github.com/docker/cli/internal/test"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
func TestManifestAnnotateError(t *testing.T) {

View File

@ -9,9 +9,9 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/distribution/reference"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
func TestManifestCreateErrors(t *testing.T) {

View File

@ -16,9 +16,9 @@ import (
digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
func newTempManifestStore(t *testing.T) (store.Store, func()) {

View File

@ -9,7 +9,7 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/distribution/reference"
"github.com/pkg/errors"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func newFakeRegistryClient() *fakeRegistryClient {

View File

@ -8,8 +8,8 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types/network"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestNetworkConnectErrors(t *testing.T) {

View File

@ -10,8 +10,8 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/network"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestNetworkCreateErrors(t *testing.T) {

View File

@ -7,7 +7,7 @@ import (
"github.com/docker/cli/internal/test"
"github.com/pkg/errors"
"gotest.tools/assert"
"gotest.tools/v3/assert"
)
func TestNetworkDisconnectErrors(t *testing.T) {

View File

@ -12,8 +12,8 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/stringid"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestNetworkContext(t *testing.T) {

View File

@ -11,9 +11,9 @@ import (
"github.com/docker/docker/api/types/filters"
"github.com/google/go-cmp/cmp"
"github.com/pkg/errors"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
func TestNetworkListErrors(t *testing.T) {

View File

@ -43,7 +43,7 @@ func NewPruneCommand(dockerCli command.Cli) *cobra.Command {
return cmd
}
const warning = `WARNING! This will remove all networks not used by at least one container.
const warning = `WARNING! This will remove all custom networks not used by at least one container.
Are you sure you want to continue?`
func runPrune(dockerCli command.Cli, options pruneOptions) (output string, err error) {

View File

@ -5,11 +5,10 @@ import (
"testing"
"github.com/docker/cli/internal/test"
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions
"github.com/docker/docker/api/types/swarm"
"github.com/pkg/errors"
"gotest.tools/assert"
// Import builders to get the builder function as package function
. "github.com/docker/cli/internal/test/builders"
"gotest.tools/v3/assert"
)
func TestNodeDemoteErrors(t *testing.T) {

View File

@ -12,8 +12,8 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/pkg/stringid"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
func TestNodeContext(t *testing.T) {

Some files were not shown because too many files have changed in this diff Show More