Skip to content

Docker: sudo support in cross-arch image builds#6074

Open
axelfontaine wants to merge 1 commit into
basecamp:quattrofrom
axelfontaine:docker-multiplatform-perms
Open

Docker: sudo support in cross-arch image builds#6074
axelfontaine wants to merge 1 commit into
basecamp:quattrofrom
axelfontaine:docker-multiplatform-perms

Conversation

@axelfontaine

@axelfontaine axelfontaine commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Setup

Run a cross-arch Docker image build with a Dockerfile containing a USER directive and sudo:

FROM alpine:latest

RUN apk add --no-cache sudo && \
    adduser -D appuser && \
    echo "appuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

USER appuser

CMD ["sudo", "whoami"]

using the following command:

docker build --platform linux/arm64 -t sudo-test . && docker run --platform linux/arm64 --rm sudo-test

Before

It fails with:

sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

After

It succeeds as expected and prints:

root

Notes

No migration needed as qemu-user-static-binfmt was only added in quattro.

Copilot AI review requested due to automatic review settings June 11, 2026 14:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a workaround so sudo works during cross-platform Docker image builds by adjusting the host’s binfmt/qemu configuration.

Changes:

  • Introduces a migration script to patch qemu-*-static.conf and restart systemd-binfmt.
  • Adds the same sed patch to the Docker install/config script.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
migrations/1780929365.sh New migration to update binfmt qemu config and restart systemd-binfmt.
install/config/docker.sh Applies the same binfmt config edit during Docker configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread migrations/1780929365.sh Outdated
Comment thread install/config/docker.sh Outdated
Comment thread migrations/1780929365.sh Outdated
Comment thread install/config/docker.sh Outdated
@axelfontaine
axelfontaine changed the base branch from dev to quattro July 21, 2026 13:32
@axelfontaine axelfontaine changed the title Ensure sudo works in cross-arch Docker image builds Docker: sudo support in cross-arch image builds Jul 21, 2026
Copilot AI review requested due to automatic review settings July 21, 2026 13:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread migrations/1780929365.sh Outdated
Comment thread install/config/docker.sh Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 13:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 21, 2026 14:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread install/config/docker.sh Outdated
@axelfontaine
axelfontaine force-pushed the docker-multiplatform-perms branch from a748764 to 30d1cd8 Compare July 21, 2026 14:18
Copilot AI review requested due to automatic review settings July 21, 2026 14:36
@axelfontaine
axelfontaine force-pushed the docker-multiplatform-perms branch from 30d1cd8 to 320a925 Compare July 21, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread install/config/docker.sh Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 14:42
@axelfontaine
axelfontaine force-pushed the docker-multiplatform-perms branch from 320a925 to c0f9e9c Compare July 21, 2026 14:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread install/config/docker.sh
Comment thread install/config/docker.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants