Commit Graph

10031 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 4473f48847
cli/command/container: provide flag-completion for "docker create"
"docker run" and "docker create" are mostly identical, so we can copy
the same completion functions,

We could possibly create a utility for this (similar to `addFlags()` which
configures both commands with the flags they share). I considered combining
his with `addFlags()`, but that utility is also used in various tests, in
which we don't need this feature, so keeping that for a future exercise.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 162d9748b9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 01:56:24 +02:00
Sebastiaan van Stijn 7a4062a4a9
cli/command/completion: add FromList utility
It's an alias for cobra.FixedCompletions but takes a variadic list
of strings, so that it's not needed to construct an array for this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 5e7bcbeac6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 01:56:24 +02:00
Sebastiaan van Stijn d914a3f97e
cli/command/completion: add EnvVarNames utility
EnvVarNames offers completion for environment-variable names. This
completion can be used for "--env" and "--build-arg" flags, which
allow obtaining the value of the given environment-variable if present
in the local environment, so we only should complete the names of the
environment variables, and not their value. This also prevents the
completion script from printing values of environment variables
containing sensitive values.

For example;

    export MY_VAR=hello
    docker run --rm --env MY_VAR alpine printenv MY_VAR
    hello

Before this patch:

    docker run --env GO
    GO111MODULE=auto        GOLANG_VERSION=1.21.12  GOPATH=/go              GOTOOLCHAIN=local

With this patch:

    docker run --env GO<tab>
    GO111MODULE     GOLANG_VERSION  GOPATH          GOTOOLCHAIN

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e3427f341b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 01:56:24 +02:00
Sebastiaan van Stijn 68fe829c96
cli/command/completion: add FileNames utility
This is just a convenience function to allow defining completion to
use the default (complete with filenames and directories).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9207ff1046)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 01:56:24 +02:00
Sebastiaan van Stijn d60252954b
cli/command/container: NewRunCommand: slight cleanup of completion
- explicitly suppress unhandled errors
- remove names for unused arguments

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit eed0e5b02a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 01:56:23 +02:00
Sebastiaan van Stijn 6cd1f6f26d
Makefile: add completion target
Add a "completion" target to install the generated completion
scripts inside the dev-container. As generating this script
depends on the docker binary, it calls "make binary" first.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3f3ecb94c5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 01:55:36 +02:00
Sebastiaan van Stijn 338e7a604c
Dockerfile.dev: install bash-completion in dev container
It's not initialized, because there's no `docker` command installed
by default, but at least this makes sure that the basics are present
for testing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3d80b7b0a7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 01:55:36 +02:00
Dan Wallis 5dea9d881c
Enable completion for 'image' sub commands
Signed-off-by: Dan Wallis <dan@wallis.nz>
(cherry picked from commit c7d46aa7a1)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 01:55:35 +02:00
Alano Terblanche 4d67ef09c8
fix: ctx cancellation on login prompt
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
(cherry picked from commit c15ade0c64)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 01:46:16 +02:00
Paweł Gronowski 69a2c9fb6d
Merge pull request #5250 from Benehiko/27.0-container-ctx
[27.0 backport] fix: container stream should not be terminated by ctx
2024-07-12 15:59:13 +02:00
Alano Terblanche 333103d93f
chore: restore ctx without cancel on container run
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
2024-07-12 15:04:38 +02:00
Alano Terblanche d36bdb0d84
test: e2e SIGTERM attached container on `docker run`
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
2024-07-12 15:04:38 +02:00
Alano Terblanche 5777558c77
fix: container stream should not be terminated by ctx
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
2024-07-12 15:04:26 +02:00
Paweł Gronowski 52848fb798
Merge pull request #5248 from vvoland/v27.0-5246
[27.0 backport] push: Don't default to `DOCKER_DEFAULT_PLATFORM`, improve message
2024-07-11 12:27:17 +02:00
Paweł Gronowski bd43ca786b
push: Improve note message and colors
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 6c04adc05e)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-07-11 12:06:02 +02:00
Paweł Gronowski 330a8e4e23
c8d: Remove `docker convert` mention
It's not merged yet.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit d40199440d)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-07-11 12:05:59 +02:00
Paweł Gronowski e0b44d6d3f
push: Don't default to DOCKER_DEFAULT_PLATFORM
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 4ce6e50e2e)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-07-11 12:05:57 +02:00
Sebastiaan van Stijn d41cb083c3
Merge pull request #5237 from dvdksn/backport_cli_reference_overview_base_cmd
[27.0 backport] cli reference overview base cmd
2024-07-05 19:55:31 +02:00
David Karlsson 0a8bb6e5b4 chore: regenerate docs
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit dc22572e3e)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-07-05 15:20:48 +02:00
David Karlsson c777dd16df docs: update cli-docs-tool (v0.8.0)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit 8549d250f6)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-07-05 15:20:45 +02:00
David Karlsson eea26c50dd docs: update links to docker cli reference
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit 3d4c12af73)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-07-05 15:20:42 +02:00
David Karlsson 1cf2c4efb3 docs: regenerate base command
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit bf33c8f10a)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-07-05 15:20:39 +02:00
David Karlsson c2b9c1474a docs: align heading structure for base command
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit b0650f281e)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-07-05 15:20:35 +02:00
David Karlsson 598442d37d docs: remove frontmatter for base command
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit cfea2353b3)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-07-05 15:20:32 +02:00
David Karlsson c964b80e53 docs: rename cli.md to docker.md (base command)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit 03961449aa)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-07-05 15:20:27 +02:00
David Karlsson 0ca7be015e docs: remove empty docker base command reference
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit a683823383)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-07-05 15:20:22 +02:00
Paweł Gronowski 59fb099da2
Merge pull request #5227 from dvdksn/backport_buildx_canonical
[27.0 backport] docs: make buildx build the canonical reference doc
2024-07-04 11:20:46 +02:00
David Karlsson 27bf78d335 docs: make buildx build the canonical reference doc
Move common flag descriptions to the buildx build reference, and make
that page the canonical page in docs. Also rewrite some content in
image_build to make clear that this page is only for the legacy builder.

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit e91f0ded9c)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-07-04 09:19:10 +02:00
Sebastiaan van Stijn 71b756be32
Merge pull request #5219 from vvoland/v27.0-5218
[27.0 backport] update to go1.21.12
2024-07-03 12:29:38 +02:00
Sebastiaan van Stijn 63a27bc9b6
Merge pull request #5208 from thaJeztah/27.0_backport_bump_engine_27.0.3
[27.0 backport] vendor: github.com/docker/docker v27.0.3
2024-07-03 12:22:56 +02:00
Paweł Gronowski 5ed8f858cf
update to go1.21.12
- https://github.com/golang/go/issues?q=milestone%3AGo1.21.12+label%3ACherryPickApproved
- full diff: https://github.com/golang/go/compare/go1.21.11...go1.21.12

These minor releases include 1 security fixes following the security policy:

net/http: denial of service due to improper 100-continue handling

The net/http HTTP/1.1 client mishandled the case where a server responds to a request with an "Expect: 100-continue" header with a non-informational (200 or higher) status. This mishandling could leave a client connection in an invalid state, where the next request sent on the connection will fail.

An attacker sending a request to a net/http/httputil.ReverseProxy proxy can exploit this mishandling to cause a denial of service by sending "Expect: 100-continue" requests which elicit a non-informational response from the backend. Each such request leaves the proxy with an invalid connection, and causes one subsequent request using that connection to fail.

Thanks to Geoff Franks for reporting this issue.

This is CVE-2024-24791 and Go issue https://go.dev/issue/67555.
View the release notes for more information:
https://go.dev/doc/devel/release#go1.21.12

**- Description for the changelog**

```markdown changelog
Update Go runtime to 1.21.12
```

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit d73d7d4ed3)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-07-03 12:16:54 +02:00
Sebastiaan van Stijn 6b99e0370c
vendor: github.com/docker/docker v27.0.3
full diff: https://github.com/docker/docker/compare/v27.0.2...v27.0.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2e6aaf05d4)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-01 12:30:22 +02:00
Laura Brehm 7d4bcd863a
Merge pull request #5206 from thaJeztah/27.0_backport_docker_27.0.2
[27.0 backport] vendor: github.com/docker/docker v27.0.2
2024-06-28 15:56:30 +01:00
Sebastiaan van Stijn 3134d55821
vendor: github.com/docker/docker v27.0.2
no diff, as it's the same commit tagged: https://github.com/docker/docker/compare/e953d76450b6...v27.0.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9455d61768)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-28 09:08:52 +02:00
Paweł Gronowski 912c1ddf8a
Merge pull request #5202 from vvoland/vendor-docker
[27.0] vendor: github.com/docker/docker v27.0.2-dev (e953d76450b6)
2024-06-26 20:39:48 +02:00
Paweł Gronowski c97e8091a6
vendor: github.com/docker/docker v27.0.2-dev (e953d76450b6)
full diff: 861fde8cc9...e953d76450

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-06-26 20:34:31 +02:00
Laura Brehm 82bd8158f7
Merge pull request #5201 from vvoland/vendor-docker
[27.0] vendor: github.com/docker/docker v27.0.2-dev (861fde8cc974)
2024-06-26 18:58:04 +01:00
Paweł Gronowski 8945848025
vendor: github.com/docker/docker v27.0.2-dev (861fde8cc974)
full diff: https://github.com/docker/docker/compare/v27.0.1...861fde8cc974

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-06-26 19:20:54 +02:00
Sebastiaan van Stijn b54897bcb8
Merge pull request #5199 from vvoland/v27.0-5191
[27.0 backport] gha/e2e: Update latest version to 27.0
2024-06-26 15:45:12 +02:00
Paweł Gronowski cd560916f3
gha/e2e: Update latest version to 27.0
27.0 is out - update the latest version used for e2e and drop the 25.0

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 60775b6150)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-06-26 15:37:10 +02:00
Laura Brehm 9a101a955b
Merge pull request #5198 from thaJeztah/27.0_backport_carry_fix_custom_ports 2024-06-26 14:19:52 +01:00
Sebastiaan van Stijn 50fae20748
cli/config/credentials: ConvertToHostname: handle IP-addresses
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8b0a7b025d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-26 15:05:38 +02:00
Sebastiaan van Stijn 37533c2f55
Merge pull request #5197 from thaJeztah/27.0_backport_fix_custom_ports
[27.0 backport] re-introduced support for port numbers in docker registry URL
2024-06-26 15:04:51 +02:00
Carston Schilds 217971d481
re-introduced support for port numbers in docker registry URL
Signed-off-by: Carston Schilds <Carston.Schilds@visier.com>
(cherry picked from commit 2380481609)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-26 14:13:24 +02:00
Paweł Gronowski fce24d5f8d
Merge pull request #5192 from vvoland/v27.0-5189
[27.0 backport] update golangci-lint to v1.59.1
2024-06-26 13:43:56 +02:00
Paweł Gronowski 0e4f16f3bf
Merge pull request #5190 from vvoland/vendor-docker
[27.0] vendor: github.com/docker/docker v27.0.1
2024-06-25 14:48:44 +02:00
Sebastiaan van Stijn 6e35a78fd9
update golangci-lint to v1.59.1
full diff: https://github.com/golangci/golangci-lint/compare/v1.59.0...v1.59.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b5d1b4de1a)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-06-25 14:45:13 +02:00
Paweł Gronowski bf1a701820
vendor: github.com/docker/docker v27.0.1
no change in vendored files, just changing a tag

full diff: https://github.com/docker/docker/compare/ff1e2c0de72a...v27.0.1

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-06-25 12:13:00 +02:00
Sebastiaan van Stijn 7fafd33de0
Merge pull request #5188 from thaJeztah/tracer_meter_optional
cli: make initializing the global meter- and tracing providers optional
2024-06-24 16:00:57 +02:00
Sebastiaan van Stijn 617eb5271a
cli: make initializing the global meter- and tracing providers optional
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-24 15:44:20 +02:00