-
Notifications
You must be signed in to change notification settings - Fork 1.4k
rootless: use Giuseppe's newuidmap/newgidmap #686
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -203,15 +203,32 @@ COPY --from=containerd /out/containerd* /usr/bin/ | |
| COPY --from=binaries / /usr/bin/ | ||
| COPY . . | ||
|
|
||
| # Apply https://github.com/shadow-maint/shadow/pull/132 so that we don't need CAP_SYS_ADMIN for newuidmap/newgidmap | ||
| # (Note: we don't use the patched idmap for the testsuite image) | ||
| FROM alpine:3.8 AS idmap | ||
| RUN apk add --no-cache autoconf automake build-base byacc gettext gettext-dev gcc git libcap-dev libtool libxslt | ||
| RUN ( git clone -b no-cap-sys-admin https://github.com/giuseppe/shadow.git /shadow && cd /shadow ) | ||
| WORKDIR /shadow | ||
| RUN ./autogen.sh --disable-nls --disable-man --without-audit --without-selinux --without-acl --without-attr --without-tcb --without-nscd \ | ||
| && make \ | ||
| && cp src/newuidmap src/newgidmap /usr/bin | ||
|
|
||
| FROM alpine AS rootless-base-internal | ||
| RUN apk add --no-cache git shadow shadow-uidmap \ | ||
| && useradd --create-home --home-dir /home/user --uid 1000 user \ | ||
| RUN apk add --no-cache git | ||
| COPY --from=idmap /usr/bin/newuidmap /usr/bin/newuidmap | ||
| COPY --from=idmap /usr/bin/newgidmap /usr/bin/newgidmap | ||
| RUN chmod u+s /usr/bin/newuidmap /usr/bin/newgidmap \ | ||
| && adduser -D -u 1000 user \ | ||
| && mkdir -p /run/user/1000 /home/user/.local/tmp /home/user/.local/share/buildkit \ | ||
| && chown -R user /run/user/1000 /home/user \ | ||
| && rm /bin/su && ln -s /bin/busybox /bin/su | ||
| && echo user:100000:65536 | tee /etc/subuid | tee /etc/subgid \ | ||
| && passwd -l root | ||
| # As of v3.8.1, Alpine does not set SUID bit on the busybox version of /bin/su. | ||
| # However, future version may set SUID bit on /bin/su. | ||
| # We lock the root account by `passwd -l root`, so as to disable su completely. | ||
|
|
||
| # tonistiigi/buildkit:rootless-base is a pre-built multi-arch version of rootless-base-internal https://github.com/moby/buildkit/pull/666#pullrequestreview-161872350 | ||
| FROM tonistiigi/buildkit:rootless-base@sha256:6d9c50e2d006c2a8745e9d7f2bc075e4469191eccada41936ec0c6070361d45a AS rootless-base-external | ||
| FROM tonistiigi/buildkit:rootless-base@sha256:51a8017db80e9757fc05071996947abb5d3e91508c3d641b01cfcaeff77e676e | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AkihiroSuda
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh sorry #690 |
||
| FROM rootless-base-$ROOTLESS_BASE_MODE AS rootless-base | ||
|
|
||
| # Rootless mode. | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't build for me. Needs
apk add --no-cache git shadowfor theuseraddbinary.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed to use busybox adduser