10387 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
b51a71148f
cli/command/system: don't use "non-distributable-artifacts" fields in tests
Nondistributable artifacts are deprecated, and no longer used; we'll be
deprecating these fields, so let's already skip their use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-07 12:24:59 +01:00
Sebastiaan van Stijn
66dfe6d428
Merge pull request #5664 from akerouanton/gw-priority
run, create, connect: add support for gw-priority
2024-12-06 22:20:57 +01:00
Sebastiaan van Stijn
97010d13f3
Merge pull request #5667 from thaJeztah/login_clean
cli/command/registry: assorted refactor and test changes
2024-12-06 14:42:22 +01:00
Sebastiaan van Stijn
e7078bf20c
Merge pull request #5668 from thaJeztah/update_go_1.23.4
update to go1.23.4
2024-12-04 13:14:52 +01:00
Sebastiaan van Stijn
a1e57ac72d
update to go1.23.4
go1.23.4 (released 2024-12-03) includes fixes to the compiler, the runtime,
the trace command, and the syscall package. See the Go 1.23.4 milestone on
our issue tracker for details:

- https://github.com/golang/go/issues?q=milestone%3AGo1.23.4+label%3ACherryPickApproved
- full diff: https://github.com/golang/go/compare/go1.23.3...go1.23.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-04 10:33:14 +01:00
Sebastiaan van Stijn
e398d16c04
cli/command/registry: return status only instead of whole response
Various functions were passing through the API response as a whole, but
effectively only needed it for a status message (if any). Reduce what's
returned to only the message.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-03 19:04:24 +01:00
Sebastiaan van Stijn
297afb2a2b
cli/command/registry: TestLoginWithCredStoreCreds slight refactor
- also check errors that were previously not handled
- use the fakeCLI's buffer instead of creating one manually

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-03 18:42:40 +01:00
Sebastiaan van Stijn
575e373669
cli/command/registry: rename some vars that collided with imports
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-03 18:37:35 +01:00
Albin Kerouanton
d4db289eb5 run, create, connect: add support for gw-priority
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2024-12-03 15:13:08 +01:00
Sebastiaan van Stijn
cf89afb32b
cli/command/registry: storeCredentials: accept configfile as arg
This function only needs access to the configfile

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-03 13:00:59 +01:00
Sebastiaan van Stijn
b5a00d0b0f
cli/command/registry: loginWithRegistry: use shallower interface
This function only needs the API client, not all of the CLI.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-03 12:50:12 +01:00
Sebastiaan van Stijn
13f0d46411
cli/command/registry: don't return creds on error
Be more explicit on not returning a response if there was an error;
change some non-exported functions to return a pointer, and return
nil instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-12-03 12:48:12 +01:00
Laura Brehm
5afa739692
Merge pull request #5660 from thaJeztah/remove_repoinfo_class 2024-12-02 13:51:47 +01:00
Sebastiaan van Stijn
ed9fcf31e6
cli/trust: GetNotaryRepository: remove uses of RepositoryInfo.Class
The Class field was added because  Docker Hub registry required a special
scope to be set for pulling plugins;

    HTTP/1.1 401 Unauthorized
    ...
    Www-Authenticate: Bearer realm="https://auth.docker.io/token",service="registry.docker.io",scope="repository(plugin):vieux/sshfs:pull",error="insufficient_scope"

This is no longer a requirement, and the field is no longer set.

updates 0ba820ed0b4a448ad6de2590c75686dd66274a4c

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-30 14:44:34 +01:00
Sebastiaan van Stijn
61b02e636d
Merge pull request #5607 from robmry/v6only/host_gateway_ip
Docs: host-gateway-ip daemon option IPv4+IPv6
2024-11-29 23:03:48 +01:00
Rob Murray
c629eca890 Put --help before --host in the dockerd manpage
Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-11-29 17:10:09 +00:00
Rob Murray
ea84e8f94b Add --host-gateway to the dockerd manpage
Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-11-29 17:10:09 +00:00
Rob Murray
cf88ab074a Docs: host-gateway-ip daemon option IPv4+IPv6
The host-gateway-ip daemon option now accepts two addresses, one
IPv4 and one IPv6.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-11-29 17:10:09 +00:00
Sebastiaan van Stijn
3be8b8c151
Merge pull request #5651 from vvoland/fix-plugin-paths
cli-plugins: Fix searching inaccessible directories
2024-11-29 15:24:54 +01:00
Sebastiaan van Stijn
083495c847
Merge pull request #5598 from robmry/dockerd-cmd-ref-ipffd
Add --ip-forward-no-drop to dockerd cmdline ref
2024-11-29 13:40:24 +01:00
Sebastiaan van Stijn
c0a5c68dc7
Merge pull request #5655 from robmry/dockerd-manpage-bip6
Add --bip6 to the dockerd manpage
2024-11-29 13:39:02 +01:00
Rob Murray
ae54c9d97f Add --bip6 to the dockerd manpage
Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-11-29 12:23:45 +00:00
Rob Murray
1911dedcf2 Add --ip-filter-forward-drop
Added to the dockerd cmdline ref and its manpage.

Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-11-29 12:17:18 +00:00
Laura Brehm
2369935bdb
Merge pull request #5645 from Benehiko/fix-run-ctx 2024-11-29 12:08:51 +01:00
Sebastiaan van Stijn
41fba28661
Merge pull request #5653 from dvdksn/docs-fix-screwy-dockerd-rendering
docs: fix janky rendering of toc on docs.docker.com
2024-11-28 17:16:10 +01:00
David Karlsson
0f058041c4 docs: fix janky rendering of toc on docs.docker.com
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-11-28 15:01:09 +01:00
Paweł Gronowski
fcd94feefb
cli-plugins: Simplify addPluginCandidatesFromDir
The returned error is always nil now, so just remove it.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-28 14:33:49 +01:00
Paweł Gronowski
6de3d71ab6
cli-plugins: Fix searching inaccessible directories
Fix a case where one inaccessible plugin search path stops the whole
search and prevents latter paths from being scanned.

Remove a preliminary `Stat` call that verifies whether path is an actual
directory and is accessible.
It's unneeded and doesn't actually check whether the directory can be
listed or not.
`os.ReadDir` will fail in such case anyway, so just attempt to do that
and ignore any encountered error, instead of erroring out the whole
plugin candidate listing.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-11-28 14:17:11 +01:00
Alano Terblanche
30a73ff19c
fix: ctx should cancel image pull on run
This patch fixes the context cancellation
behaviour for the `runContainer` function,
specifically the `createContainer` function
introduced in this commit 991b1303da.

It delays stripping the `cancel` from the context
passed into the `runContainer` function so that
the `createContainer` function can be cancelled
gracefully by a SIGTERM/SIGINT.

This is especially true when the requested image
does not exist and `docker run` needs to `pull`
the image before creating the container.

Although this patch does gracefully cancel
the `runContainer` function it does not address
the root cause. Some functions in the call path
are not context aware, such as `pullImage`.

Future work would still be necessary to ensure
a consistent behaviour in the CLI.

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
2024-11-28 09:53:04 +01:00
Sebastiaan van Stijn
682cf57d73
Merge pull request #5597 from robmry/dockerd-cmd-ref-bip6
Add --bip6 to dockerd cmdline ref
2024-11-28 00:08:52 +01:00
Sebastiaan van Stijn
bc908a655f
Merge pull request #5650 from laurazard/cleanup-tests-1
tests: cleanup table test names
2024-11-27 18:35:15 +01:00
Laura Brehm
1d4a7ae082
tests: cleanup table test names
There's no need for `case=[xxx]` in table tests, Go does a good job of
formatting the test output and we're just adding the same information
for every test output line.

Previously:
```console
$ go test -count=1 -v -run=TestPromptForConfirmation ./cli/command
=== RUN   TestPromptForConfirmation
=== RUN   TestPromptForConfirmation/case=SIGINT
=== RUN   TestPromptForConfirmation/case=no
=== RUN   TestPromptForConfirmation/case=yes
=== RUN   TestPromptForConfirmation/case=any
=== RUN   TestPromptForConfirmation/case=with_space
=== RUN   TestPromptForConfirmation/case=reader_closed
--- PASS: TestPromptForConfirmation (0.00s)
    --- PASS: TestPromptForConfirmation/case=SIGINT (0.00s)
    --- PASS: TestPromptForConfirmation/case=no (0.00s)
    --- PASS: TestPromptForConfirmation/case=yes (0.00s)
    --- PASS: TestPromptForConfirmation/case=any (0.00s)
    --- PASS: TestPromptForConfirmation/case=with_space (0.00s)
    --- PASS: TestPromptForConfirmation/case=reader_closed (0.00s)
PASS
ok      github.com/docker/cli/cli/command       0.013s
```

After:
```console
go test -count=1 -v -run=TestPromptForConfirmation ./cli/command
=== RUN   TestPromptForConfirmation
=== RUN   TestPromptForConfirmation/SIGINT
=== RUN   TestPromptForConfirmation/no
=== RUN   TestPromptForConfirmation/yes
=== RUN   TestPromptForConfirmation/any
=== RUN   TestPromptForConfirmation/with_space
=== RUN   TestPromptForConfirmation/reader_closed
--- PASS: TestPromptForConfirmation (0.00s)
    --- PASS: TestPromptForConfirmation/SIGINT (0.00s)
    --- PASS: TestPromptForConfirmation/no (0.00s)
    --- PASS: TestPromptForConfirmation/yes (0.00s)
    --- PASS: TestPromptForConfirmation/any (0.00s)
    --- PASS: TestPromptForConfirmation/with_space (0.00s)
    --- PASS: TestPromptForConfirmation/reader_closed (0.00s)
PASS
ok      github.com/docker/cli/cli/command       0.009s
```

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-11-27 16:46:34 +00:00
Alano Terblanche
ba1a15433b
Merge pull request #5648 from Benehiko/improve-contribution
chore: update commit guidelines in CONTRIBUTING.md
2024-11-26 13:09:48 +01:00
Alano Terblanche
4a219b1a41
chore: update commit guidelines in CONTRIBUTING.md
The commit guidelines are too vague and offer little guidance on
acceptable commit styles. This patch expands on what is acceptable
with some examples of what a commit is supposed to look like.

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Co-authored-by: Christopher Petito <47751006+krissetto@users.noreply.github.com>
2024-11-26 12:38:28 +01:00
Sebastiaan van Stijn
6c76914532
Merge pull request #5637 from thaJeztah/bump_rosetta
vendor: github.com/tonistiigi/go-rosetta v0.0.0-20220804170347-3f4430f2d346
2024-11-21 17:53:16 +01:00
Sebastiaan van Stijn
7b67057c32
Merge pull request #5636 from thaJeztah/bump_codecov_action
build(deps): bump codecov/codecov-action from 4 to 5
2024-11-21 17:52:41 +01:00
Sebastiaan van Stijn
9ccc462005
Merge pull request #5634 from thaJeztah/bump_mapstructure
vendor: github.com/go-viper/mapstructure/v2 v2.2.1
2024-11-21 17:52:21 +01:00
Sebastiaan van Stijn
35bf069da2
Merge pull request #5633 from thaJeztah/bump_capability
vendor: github.com/moby/sys/capability v0.4.0
2024-11-21 17:51:57 +01:00
Sebastiaan van Stijn
9b72a58d35
Merge pull request #5632 from thaJeztah/bump_golangci_lint
update golangci-lint to v1.62.0
2024-11-21 17:51:22 +01:00
Sebastiaan van Stijn
6aeba15e55
Merge pull request #5630 from thaJeztah/bump_goversioninfo
Dockerfile: bump github.com/josephspurrier/goversioninfo to v1.4.1
2024-11-21 17:50:45 +01:00
Sebastiaan van Stijn
a93fb1678a
Merge pull request #5638 from thaJeztah/bump_engine
vendor: github.com/docker/docker e5c2b5e10d68 (master, v28.0.0-dev)
2024-11-21 09:54:53 +01:00
Sebastiaan van Stijn
d41b80fafc
vendor: github.com/docker/docker e5c2b5e10d68 (master, v28.0.0-dev)
full diff: 6ac445c42b...e5c2b5e10d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-20 15:54:27 +01:00
Sebastiaan van Stijn
11fbc99939
vendor: github.com/tonistiigi/go-rosetta v0.0.0-20220804170347-3f4430f2d346
full diff: f79598599c...3f4430f2d3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-19 21:51:51 +01:00
dependabot[bot]
b0c0cd5e32
build(deps): bump codecov/codecov-action from 4 to 5
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-19 13:53:08 +01:00
Sebastiaan van Stijn
81401f37f2
Merge pull request #5625 from Giedriusj1/master
Optimise `docker stats` to not require clearing the whole screen
2024-11-19 12:48:26 +01:00
Sebastiaan van Stijn
f6599300ff
vendor: github.com/go-viper/mapstructure/v2 v2.2.1
full diff: https://github.com/go-viper/mapstructure/compare/v2.0.0...v2.2.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-19 11:49:17 +01:00
Sebastiaan van Stijn
446d4138ed
vendor: github.com/moby/sys/capability v0.4.0
full diff: https://github.com/moby/sys/compare/capability/v0.3.0...capability/v0.4.0

Added

* New separate API for ambient ([GetAmbient], [SetAmbient], [ResetAmbient])
  and bound ([GetBound], [DropBound]) capabilities, modelled after libcap.

Fixed

* [Apply] now returns an error if called for non-zero `pid`. Before this change,
  it could silently change some capabilities of the current process, instead of
  the one identified by the `pid`.
* Fixed tests that change capabilities to be run in a separate process.
* Other improvements in tests.

Changed

* Use raw syscalls (which are slightly faster).
* Most tests are now limited to testing the public API of the package.
* Simplify parsing /proc/*pid*/status, add a test case.
* Optimize the number of syscall to set ambient capabilities in Apply
  by clearing them first; add a test case.
* Better documentation for [Apply], [NewFile], [NewFile2], [NewPid], [NewPid2].

Removed

* `.golangci.yml` and `.codespellrc` are no longer part of the package.

<!-- Doc links (please keep sorted). -->
[Apply]: https://pkg.go.dev/github.com/moby/sys/capability#Capabilities.Apply
[DropBound]: https://pkg.go.dev/github.com/moby/sys/capability#DropBound
[GetAmbient]: https://pkg.go.dev/github.com/moby/sys/capability#GetAmbient
[GetBound]: https://pkg.go.dev/github.com/moby/sys/capability#GetBound
[LastCap]: https://pkg.go.dev/github.com/moby/sys/capability#LastCap
[ListKnown]: https://pkg.go.dev/github.com/moby/sys/capability#ListKnown
[ListSupported]: https://pkg.go.dev/github.com/moby/sys/capability#ListSupported
[List]: https://pkg.go.dev/github.com/moby/sys/capability#List
[NewFile2]: https://pkg.go.dev/github.com/moby/sys/capability#NewFile2
[NewFile]: https://pkg.go.dev/github.com/moby/sys/capability#NewFile
[NewPid2]: https://pkg.go.dev/github.com/moby/sys/capability#NewPid2
[NewPid]: https://pkg.go.dev/github.com/moby/sys/capability#NewPid
[ResetAmbient]: https://pkg.go.dev/github.com/moby/sys/capability#ResetAmbient
[SetAmbient]: https://pkg.go.dev/github.com/moby/sys/capability#SetAmbient

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-19 11:37:18 +01:00
Sebastiaan van Stijn
07e5ddd054
update golangci-lint to v1.62.0
full diff: https://github.com/golangci/golangci-lint/compare/v1.61.0...v1.62.0
Changelog: https://golangci-lint.run/product/changelog/#v1620

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-19 11:05:27 +01:00
Sebastiaan van Stijn
93a931920b
Dockerfile: bump github.com/josephspurrier/goversioninfo to v1.4.1
full diff: https://github.com/josephspurrier/goversioninfo/compare/v1.3.0...v1.4.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-19 00:36:15 +01:00
Giedrius Jonikas
cb2f95ceee Optimise docker stats to not require clearing the whole screen
Instead of clearing the whole screen and then writing the new stats,
we now write the new stats on top of the old text, and then clear
the remaining text.

This is a more efficient way to update the stats, as it avoids the
flickering that happens when the screen is cleared and rewritten.

Signed-off-by: Giedrius Jonikas <giedriusj1@gmail.com>
2024-11-16 15:29:57 +00:00