While go1.23 still works, it's already EOL, so it may be a better
starting point to use that as minimum version for these modules, as
they're brand new.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The docker documentation website may not be publishing rendered versions
of the swagger for deprecated API versions, so let's remove these links
from the changelog.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- Introduced DefaultIsolation method in the Daemon to return the daemon configured isolation mode for Windows.
Signed-off-by: Vigilans <vigilans@foxmail.com>
These tests were failing because the "docker run" did not print the
ID of the container, and instead detached immediately without printing;
```
=== Failed
=== FAIL: amd64.integration-cli TestDockerCLICommitSuite/TestCommitAfterContainerIsDone (0.27s)
docker_cli_commit_test.go:32: assertion failed:
Command: /usr/local/cli-integration/docker wait
ExitCode: 1
Error: exit status 1
Stdout:
Stderr: invalid container name or ID: value is empty
Failures:
ExitCode was 1 expected 0
Expected no error
--- FAIL: TestDockerCLICommitSuite/TestCommitAfterContainerIsDone (0.27s)
=== FAIL: amd64.integration-cli TestDockerCLICommitSuite/TestCommitWithoutPause (0.20s)
docker_cli_commit_test.go:47: assertion failed:
Command: /usr/local/cli-integration/docker wait
ExitCode: 1
Error: exit status 1
Stdout:
Stderr: invalid container name or ID: value is empty
Failures:
ExitCode was 1 expected 0
Expected no error
--- FAIL: TestDockerCLICommitSuite/TestCommitWithoutPause (0.20s)
```
What happens is that it starts a container with only `stdin` attached, but
no `stdout`, and the behavior changed between versions of the CLI, which
may be either a bugfix or a regression;
docker 28 cli doesn't stay attached:
```bash
Status: Downloaded newer image for docker:28-cli
/ # docker run -i -a stdin busybox echo foo
/ #
```
docker 27 cli stays attached, but has the "three strikes, you're out" handling:
```bash
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock docker:27-cli sh
Status: Downloaded newer image for docker:27-cli
/ # docker run -i -a stdin busybox echo foo
9dbb29080a72225593885bc4880d8f4f22f36803100179f9725468bda1d52b4f
^C^C^C
got 3 SIGTERM/SIGINTs, forcefully exiting
/ # ^C
```
docker 26 cli (and older) don't forward the signal to the container, and detach-keys don't work (or in this case, are handled by the CLI container)?:
```bash
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock docker:26-cli sh
Status: Downloaded newer image for docker:26-cli
/ # docker run -i -a stdin busybox echo foo
21963ce1b9a7bb7eccef3618693b09a106fb29084b484e31c69cd4a26ee44777
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C
<CTRL>p,q
```
As these tests were not testing that part, I simplified the tests, but
we should probably look into the change of behavior to see if it was
intentional (and if it was correct).
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
On daemon shutdown, the HTTP server tries to gracefully shutdown for 5
seconds. If there's an open API connection to the '/events' endpoint, it
fails to do so as nothing interrupts that connection, thus forcing the
daemon to wait until that timeout is reached.
Add a Close method to the EventsService, and call it during daemon
shutdown. It'll close any events channel, signaling to the '/events'
handler to return and close the connection.
It now takes ~1s (or less) to shutdown the daemon when there's an active
'/events' connection, instead of 5.
Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
Use a singleflight for collecting the build-cache usage; collecting this
information is potentially heavy-weight, and we already do this for the
other disk-usage methods.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
commit a69abdd90d introduced a "verbose"
option for the disk-usage endpoint, which allowed omitting the items
to be included in the results.
However, it did not take into account that a singleflight is used to
allow sharing the results between requests; this means that a request
made while another request is already in flight could share the wrong
results, and either get "verbose" or "non-verbose", depending on the
request already in flight.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
These fields have been removed from the API specification, and the struct
was only needed to produce legacy responses (server), or to unmarshal
legacy responses in the client.
As the API module only provides API definitions for the current API version,
we should remove these legacy structs, and keep them internal to the daemon
and client.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Now that we separated the legacy response from non-legacy responses,
we can consume the data produced by the backend as-is; the backend
takes care of omitting "verbose" data (leaving the `Items` slices
empty), and with an early return for the legacy responses, we won't
end up with returning _both_ responses on API < v1.52, but (TBD) still
return both responses for API v1.52.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Use early return for legacy response. When using API < v1.52, we'd
never return the new fields, so we can return early, and produce the
legacy-fields only.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Set values directly on the DiskUsage objects instead of using some
intermediate vars, some of which were named slightly confusing due
to them being used both for "totalSize" and "reclaimableSize".
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Move calculation of the data to the builder backend, to align with
the other type of objects. This also allows us to skip the verbose
data if it's not used.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Make the "per-object" types aliases for the API type, and remove
the BuildCacheDiskUsage type, as it's not currently used.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>