Skip to content

Build fails when shared context directory contains non-ASCII characters - #3972

Closed
maxproske wants to merge 1 commit into
docker:masterfrom
maxproske:sanitize-sharedkey
Closed

Build fails when shared context directory contains non-ASCII characters#3972
maxproske wants to merge 1 commit into
docker:masterfrom
maxproske:sanitize-sharedkey

Conversation

@maxproske

Copy link
Copy Markdown

Initially caught by docker/compose#13965 2 Compose services sharing a build context containing Chinese characters, but after some digging, every build dialed over gRPC fails. Same as #2793 which was closed as not reproducible.

Sanitize the shared key before it reaches gRPC.

Steps to reproduce:

mkdir -p 早

docker buildx create --name repro --driver docker-container
docker buildx build --builder repro 早

docker buildx bake -f - a b <<'EOF'
target "a" { context = "早" }
target "b" { context = "早" }
EOF

docker compose -f - build <<'EOF'
services:
  a: {build: 早}
  b: {build: 早}
EOF

All 3 fail with:

failed to dial gRPC: rpc error: code = Internal desc = rpc error: code = Internal desc = header key "x-docker-expose-session-sharedkey" contains value with non-printable ASCII characters

Signed-off-by: Max Proske <max@mproske.com>
@maxproske

Copy link
Copy Markdown
Author

Newbie question: if approved, worth me guarding downstream in buildkit too?

@crazy-max crazy-max left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks but I think this should probably be fixed in BuildKit by encoding the shared key when it's put into session metadata and decoding it in the session manager, rather than hashing it in Buildx.

@crazy-max

Copy link
Copy Markdown
Member

opened moby/buildkit#6989

@crazy-max

Copy link
Copy Markdown
Member

Closing this one as moby/buildkit#6989 is probably the right fix but thanks again for your contribution!

@crazy-max crazy-max closed this Jul 30, 2026
@maxproske

Copy link
Copy Markdown
Author

Agreed!

Gloria668866 added a commit to Gloria668866/study_code that referenced this pull request Jul 31, 2026
Chinese directory name 车市镜/ breaks buildx gRPC session
('x-docker-expose-session-sharedkey' non-printable ASCII).
Copy subtree to /tmp/cheshijing-ctx before docker build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants