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

Make the docker user non-root for easier volume sharing #550

Merged
merged 4 commits into from
Sep 10, 2022

Conversation

jtannas
Copy link
Collaborator

@jtannas jtannas commented Sep 9, 2022

The swagger.json/Gemfile.lock files generated inside of the test-app are created by the docker user. The docker user is root by default. When using docker-compose volumes to share files between the host & the container, the generated file retains the root docker user as the owner. This prevents any edits from being made to those files locally without using either sudo or sudo chown.

The solution is to set the container user id to match your own user id. Typically you'll be USER_ID=1000 on your own machine, and you can double check that using $ id -u.
If your user id differs, then docker build --build-arg USER_ID=$(id -u) . will pass your id into the docker container build.

@jtannas jtannas changed the base branch from master to update-changelog-2.6.0 September 9, 2022 16:30
@jtannas
Copy link
Collaborator Author

jtannas commented Sep 9, 2022

Draft pending merge of update-changelog-2.6.0 to master

Copy link
Member

@BookOfGreg BookOfGreg left a comment

Choose a reason for hiding this comment

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

Good use of docker best practice there.

Base automatically changed from update-changelog-2.6.0 to master September 10, 2022 18:14
@jtannas jtannas marked this pull request as ready for review September 10, 2022 18:15
@jtannas jtannas merged commit 9f17fa2 into master Sep 10, 2022
@jtannas jtannas deleted the limit-docker-permissions branch September 10, 2022 20:12
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.

None yet

2 participants