Repository navigation
Fix session mode with log drivers that cannot be read - #751
Open
Adham-Kiwan wants to merge 1 commit into
Open
Adham-Kiwan wants to merge 1 commit into
Adham-Kiwan wants to merge 1 commit into
Conversation
In session mode the backend attaches to the container with log replay turned on. With a log driver that does not support reading, such as "none", Docker gives back an attach stream that carries no output, so the session never sees what the program prints. Connection mode is not affected because it attaches through exec. The attach happens before the container is started, so there is never anything to replay. Turn log replay off, and add a session conformance case that runs with the "none" log driver. Fixes ContainerSSH#750 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Adham Kiwan <adhamkiwan@outlook.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #750.
In session mode,
dockerV20Container.attach()callsContainerAttachwithLogs: true. If the container uses a log driver that cannot be read, such asnone, Docker returns an attach stream with no output in it, so the SSH session never gets the program's output. Connection mode goes throughContainerExecAttachand doesn't have this problem, which matches the report.attach()runs beforestart()inhandler_channel.go, so there are never any earlier logs to replay. This PR setsLogs: false.Testing
alpinecontainer with--log-driver noneand attached withstream=1&stdout=1&stderr=1, then started it. Withlogs=1the attach stream came back empty. Withlogs=0it carried the program'shellooutput.session-log-driver-nonecase toTestConformanceininternal/docker. It runs the full session-mode conformance suite withHostConfig.LogConfig.Type = "none".go build ./...andgo vet ./internal/docker/pass.I could not run the conformance suite locally, so please rely on CI for it. My machine is arm64, and
containerssh/containerssh-guest-imagehas no arm64 build.This change was prepared with help from an AI coding assistant. I reviewed it and checked the behaviour against a real Docker daemon.