-
Notifications
You must be signed in to change notification settings - Fork 237
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
Update Dockerfile
and utils/aosp
to work with arbitrary uid gid
#11
Merged
kylemanna
merged 11 commits into
kylemanna:master
from
jcfr:support-current-user-with-arbitrary-uid-gid
Apr 21, 2016
Merged
Update Dockerfile
and utils/aosp
to work with arbitrary uid gid
#11
kylemanna
merged 11 commits into
kylemanna:master
from
jcfr:support-current-user-with-arbitrary-uid-gid
Apr 21, 2016
Conversation
This file contains 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
See https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#user Suggested-by: Mathieu Maret <mmaret@genymobile.com>
Suggested-by: Philipp Hug <philipp@hug.cx>
…call Now directories are owned by aosp user, there is not need to explicitly chmod to 777. Current user will create and own the folder.
The image now provides both openjdk-7 and openjdk-8
Cc: @dhanainme @kylemanna |
…id/gid This commit introduces the "docker_entrypoint" script that will create a user with uid/gid matching given `USER_ID` and `GROUP_ID` (or default to `1000` if not provided). Fixes kylemanna#9 This approach works around missing docker feature discussed in moby/moby#7198 and allow to have executable in the docker container manipulating files in the shared volume owned by the `USER_ID:GROUP_ID` The utility script `aosp` has also been updated to automatically set `USER_ID` and `GROUP_ID` to the value matching the current user by invoking "docker run" with ``` -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) ``` Finally, the output has also been updated to be more verbose. For example: ``` $ AOSP_VOL=/home/jcfr/Projects/aosp-root/ aosp id aosp: Checking if /home/jcfr/Projects/aosp-root/aosp exists aosp: Checking if /home/jcfr/Projects/aosp-root/aosp exists - ok aosp: Checking if /home/jcfr/Projects/aosp-root/ccache exists aosp: Checking if /home/jcfr/Projects/aosp-root/ccache exists - ok docker_entrypoint: Creating user UID/GID [1000/1000] docker_entrypoint: Creating user UID/GID [1000/1000] - done docker_entrypoint: Copying .gitconfig and .ssh/config to new user home docker_entrypoint: Copying .gitconfig and .ssh/config to new user home - done docker_entrypoint: Creating /tmp/ccache and /asop directory docker_entrypoint: Creating /tmp/ccache and /asop directory - done uid=1000(aosp) gid=1000(aosp) groups=1000(aosp) ```
6b55800
to
91ae4a8
Compare
The script should not attempt to create a folder "/vol0" in the filesystem of the host, instead the directory "~/aosp-root" is created.
4976622
to
f1b7f6a
Compare
Gave it a test last night and it works for me. Thanks for keeping the commits clean and atomic 👍 |
Great. Thanks for reviewing and integrating. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Along with including various tweaks, this PR addresses issue #9 to allow working with a current user
having an arbitrary UID/GID.
In a nutshell, it introduces the "docker_entrypoint" script that will create
a user with uid/gid matching given
USER_ID
andGROUP_ID
(or default to1000
if not provided).Fixes #9
This approach works around missing docker feature discussed in
moby/moby#7198 and allow to have executable in the docker container
manipulating files in the shared volume owned by the
USER_ID:GROUP_ID
The utility script
aosp
has also been updated to automaticallyset
USER_ID
andGROUP_ID
to the value matching the current userby invoking "docker run" with
Finally, the output has also been updated to be more verbose. For example: