-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
usermod for php containers #15
Comments
AFAIR this setting strongly depends on your local development environment, i.e. host-OS and host-volumes. What's your docker setup? Currently I run this in the docker-entrypoint script:
|
@mkiselev I can not confirm that. Files created from PHP inside the container belong to Permission Maybe I misunderstood and you can give an example to clarify. |
Example from container bash on OS X with
|
I am using linux as host machine and in all my Dockerfiles:
So my container runs as user and |
@mkiselev Closing this for now as I don't see, how a |
@mikehaertl I think this should be a documentation issue then. |
Well, we can add something. The problem is really only with files created during development in a directory mapped into the container. Migrations being the best example: They'll be owned by There's usually no problem in production though. So I still think a little note about this is sufficient. |
This issue also occurs when running i.e. CC: @handcode |
Docker version 17.03.1-ce, build c6d412e image ubuntu 14.04 Step 6/7 : RUN addgroup -S -g 1000 docker adduser --system [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] adduser --group [--gid ID] GROUP addgroup --system [--gid ID] GROUP adduser USER GROUP general options: ERROR: Service 'phpfpm' failed to build: The command '/bin/sh -c addgroup -S -g 1000 docker' returned a non-zero code: 1 |
Because switching the user on ie. Alpine was very difficult or it required dozens of MBs for additional tools, we ended up in doing:
In the yii CLI script. Related: yiisoft/yii-base-web#1 |
I edited ENV PHP_USER_ID=33 \ to ENV PHP_USER_ID=1000 \
how to fix this. because when I set to default PHP_USER_ID = 33 it run normally |
That's strange, because your error says:
Actually you should not change that in the |
I modify Dockerfile-debian to ENV PHP_USER_ID=1000 because PHP_USER_ID=1000 at .ENV didnt work. www-data still 33 at end, I add |
But when you enter the container to run composer you are |
I enter container with: |
Why do you want to run composer as www-data and not as root? |
|
|
I totally agree on a standard (bare-metal, non-VM) system. But what's an attack scenario in a container? Doesn't www-data need to have effectively the same permissions as root? [addon] We also disable the warning btw https://github.com/yiisoft/yii2-docker/blob/master/php/Dockerfile-debian#L86 |
How about add
RUN usermod -u 1000 www-data
for php containers? :)Because now container set root permission for files which create.
The text was updated successfully, but these errors were encountered: