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

Create container using non-root user #3

Open
dbjpanda opened this issue Sep 19, 2018 · 0 comments
Open

Create container using non-root user #3

dbjpanda opened this issue Sep 19, 2018 · 0 comments

Comments

@dbjpanda
Copy link
Owner

dbjpanda commented Sep 19, 2018

user ID and group ID inside the container and on the host machine should match, in order to let the host machine to grant you permissions to the share directory.

1- Create nonroot user inside nginx and php image
2- Pass UID:GID from docker host to containers to fix permission issue

Create Non root user:
https://dev.to/acro5piano/specifying-user-and-group-in-docker-i2e
https://medium.com/redbubble/running-a-docker-container-as-a-non-root-user-7d2e00f8ee15
docker/compose#2380
https://boxboat.com/2017/07/25/fixuid-change-docker-container-uid-gid/
https://cinhtau.net/2017/04/19/usermod-and-groupmod-alpine/

Add non-root user to sudoers
https://github.com/michaelsauter/docker-alpine/blob/master/Dockerfile

Create an user inside container as per UID:GROUP from the docker host
USER_ID=$(stat -c "%u" /var/www/"$PROJECT_NAME"/LICENSE)

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

No branches or pull requests

1 participant