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

Skips getting UID/GUID if passwd/group file is not found #2249

Merged
merged 1 commit into from
Jul 13, 2021

Conversation

claudiubelu
Copy link
Contributor

@claudiubelu claudiubelu commented Jul 13, 2021

When running a WORKDIR instruction, buildkit will create that folder and chown it to the currently set user. For this, it will try to read the /etc/passwd file to get the proper UID, and if that user is not found in the file, the root user will be considered as the owner.

However, Windows images do not have that file, which will result in an error while building the image. We can consider not finding
the /etc/passwd file as the same as not finding the user in the file, which would solve this issue.

Fixes: docker/buildx#378

Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

PTAL DCO error

solver/llbsolver/file/user_linux.go Show resolved Hide resolved
@tonistiigi
Copy link
Member

Check DCO

When running a WORKDIR instruction, buildkit will create that folder
and chown it to the currently set user. For this, it will try to read
the /etc/passwd file to get the proper UID, and if that user is not
found in the file, the root user will be considered as the owner.

However, Windows image do not have that file, which will result in
an error while building the image. We can consider not finding
the /etc/passwd file as the same as not finding the user in the file,
which would solve this issue.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
@tonistiigi tonistiigi merged commit d3cd28f into moby:master Jul 13, 2021
@smakintel
Copy link

for windows

make sure your docker compose has user set

user: ${CURRENT_UID}

then using gitbash run below command it should fix : /etc/passwd not found issue
CURRENT_UID=$(id -u):$(id -g) docker-compose up -d

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.

WORKDIR command fails on Windows images
3 participants