Paweł Gronowski
c27751fcfe
container/run: Fix stdout/err truncation after container exit
...
Fix a regression introduced by 30c4637f03
which made the `docker run` command produce potentially truncated
stdout/stderr output.
Previous implementation stopped the content streaming as soon as the
container exited which would potentially truncate a long outputs.
This change fixes the issue by only canceling the IO stream immediately
if neither stdout nor stderr is attached.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com >
2025-03-24 17:09:32 +01:00
Alano Terblanche
0cff340983
cmd/docker: do not print error status on exec/run
...
Co-authored-by: Fabio Pugliese Ornellas <fabio.ornellas@gmail.com >
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com >
2025-02-21 12:55:57 +01:00
Laura Brehm
30c4637f03
run: don't hang if only attaching STDIN
...
If STDOUT or STDERR are attached and the container exits, the streams
will be closed by the daemon while the container is exiting, causing
the streamer to return an error
https://github.com/docker/cli/blob/61b02e636d2afed778f2e871c3ec1c6adee69ca4/cli/command/container/hijack.go#L53
that gets sent
https://github.com/docker/cli/blob/61b02e636d2afed778f2e871c3ec1c6adee69ca4/cli/command/container/run.go#L278
and received
https://github.com/docker/cli/blob/61b02e636d2afed778f2e871c3ec1c6adee69ca4/cli/command/container/run.go#L225
on `errCh`.
However, if only STDIN is attached, it's not closed (since this is
attached to the user's TTY) when the container exits, so the streamer
doesn't exit and nothing gets sent on `errCh`, meaning the CLI execution
hangs receiving on `errCh` on L231.
Change the logic to receive on both `errCh` and `statusChan` – this way,
if the container exits, we get notified on `statusChan` (even if only
STDIN is attached), and can cancel the streamer and exit.
Signed-off-by: Laura Brehm <laurabrehm@hey.com >
2024-12-09 15:49:20 +00:00
Sebastiaan van Stijn
6489a777e5
e2e: remove redundant capturing of loop vars in tests (copyloopvar)
...
go1.22 and up now produce a unique variable in loops, tehrefore no longer
requiring to capture the variable manually;
service/logs/parse_logs_test.go:50:3: The copy of the 'for' variable "tc" can be deleted (Go 1.22+) (copyloopvar)
tc := tc
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2024-11-05 10:14:30 +01:00
Alano Terblanche
0579cd7971
test: e2e SIGTERM attached container on docker run
...
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com >
2024-07-09 13:23:38 +02:00
Laura Brehm
8d6e571c03
Add e2e tests for run w/ bad entrypoint
...
Signed-off-by: Laura Brehm <laurabrehm@hey.com >
2024-05-07 11:22:18 +01:00
Paweł Gronowski
edc09e6038
mount: Add volume-subpath option
...
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com >
2024-02-13 14:04:00 +01:00
Christopher Petito
30dd7c1319
Minor test fixes necessary for eventually upgrading ci runners and engine version
...
Signed-off-by: Christopher Petito <chrisjpetito@gmail.com >
2024-02-09 13:55:03 +00:00
Sebastiaan van Stijn
8661552e7a
golangci-lint: enable thelper linter
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2023-11-20 16:02:17 +01:00
Paweł Gronowski
41b6ec07ce
e2e: Skip tests with platform-specific digests on other platforms
...
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com >
2023-04-27 10:57:56 +02:00
Sebastiaan van Stijn
2c0e93063b
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 >
2020-02-23 00:28:55 +01:00
Rob Gulewich
5ad1d4d4c8
docker run: specify cgroup namespace mode with --cgroupns
...
Signed-off-by: Rob Gulewich <rgulewich@netflix.com >
2020-01-29 22:50:37 +00:00
glefloch
348f24cae6
Add content trust tests for run command
...
Signed-off-by: Guillaume Le Floch <glfloch@gmail.com >
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2020-01-20 14:18:52 +01:00
Vincent Demeester
2c4de4fb5e
Update tests to use gotest.tools 👼
...
Signed-off-by: Vincent Demeester <vincent@sbr.pm >
2018-06-08 18:24:26 +02:00
Christopher Crone
6b38918ce4
Make e2e test image
...
- Build image that contains everything needed to run e2e tests
- Add ability to run e2e tests against an endpoint
Signed-off-by: Christopher Crone <christopher.crone@docker.com >
2018-05-29 13:39:31 +02:00
Vincent Demeester
ae03dd7f46
Handle some TODOs in tests
...
Use more gotestyourself for `env.Patch`, and `icmd.RunCommand`
Signed-off-by: Vincent Demeester <vincent@sbr.pm >
2018-04-23 14:13:52 +02:00
Vincent Demeester
8b00c5cfd8
Add more content trust tests
...
Importing from moby's DockerTrustSuite tests.
Signed-off-by: Vincent Demeester <vincent@sbr.pm >
2018-03-19 10:02:40 +01:00
Daniel Nephin
39c2ca57c1
Automated migration
...
Signed-off-by: Daniel Nephin <dnephin@docker.com >
2018-03-05 19:41:17 -05:00
Kyle Spiers
cbd78572a7
e2e tests: refactor using fixtures
...
Signed-off-by: Kyle Spiers <kyle@spiers.me >
2017-11-13 17:18:04 -08:00
Daniel Nephin
c34360cc8e
Add an end-to-end test for container run
...
for testing attach, remove, and pull image when missing.
Signed-off-by: Daniel Nephin <dnephin@docker.com >
2017-09-06 17:07:38 -04:00