Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User namespace remapping doesn't work with multi-stage builds #392

Open
shaneog opened this issue Mar 12, 2018 · 10 comments
Open

User namespace remapping doesn't work with multi-stage builds #392

shaneog opened this issue Mar 12, 2018 · 10 comments
Labels
docker Relates to the use of Docker on stack agents

Comments

@shaneog
Copy link

shaneog commented Mar 12, 2018

User namespace remapping doesn't work when you use multi-stage builds such as with the below Dockerfile.

Is this possible to fix, or am I stuck with using user namespace remapping OR multi-stage builds?

References:
moby/moby#34645
buildkite/agent#407

Example Repo: https://github.com/shaneog/bk-issue-392

Error:

ERROR: Service 'app' failed to build: failed to copy files: failed to copy file: Container ID 500000 cannot be mapped to a host ID

Dockerfile:

FROM debian:stretch as build
RUN touch x && chown 1:1 x

FROM debian:stretch
RUN touch y && chown 1:1 y
COPY --from=build x ./

Using Buildkite stack v2.3.5
The stack was created with all default values, except for the agent token, and enabling "User namespace remapping"

@lox
Copy link
Contributor

lox commented Mar 16, 2018

Thanks @shaneog, this is a tricky one! 🤔

@lox
Copy link
Contributor

lox commented Mar 18, 2018

A possible workaround is to chown -R root:root ... in the --from image and then restore the ownership in the target image.

From the moby issue, might that be viable in your case @shaneog?

@shaneog
Copy link
Author

shaneog commented Mar 19, 2018

I've disabled user namespace remapping for now, and I'm using the permission scripts to fix any file ownership issues.

@lox
Copy link
Contributor

lox commented Apr 30, 2018

We've brought back EnableDockerUserNamespaceRemap in #410. You can use this in https://s3.amazonaws.com/buildkite-aws-stack/master/aws-stack.json and we'll be cutting a 3.1.0 release soon.

@lox lox closed this as completed Apr 30, 2018
@lox
Copy link
Contributor

lox commented Jul 16, 2018

I'm going to re-open this one, as it's still an issue when user namespace remapping is turned on.

@pda
Copy link
Member

pda commented Mar 28, 2019

Looks like it's still an issue in the latest buildkite/elastic-ci-stack-for-aws with default configuration?

@pda
Copy link
Member

pda commented Mar 28, 2019

(for some reason upgrading the stack from v3.2.1 to v4.2.0 has triggered this issue for us, even though v3.2.0 seems to be where EnableDockerUserNamespaceRemap was enabled by default)

@pda
Copy link
Member

pda commented Mar 28, 2019

((ah — we had EnableDockerUserNamespaceRemap set to false in the old stack, and true in the new stack))

@lox
Copy link
Contributor

lox commented Mar 28, 2019

Yup, still an issue @pda.

@jufemaiz
Copy link
Contributor

👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker Relates to the use of Docker on stack agents
Projects
None yet
Development

No branches or pull requests

5 participants