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

Add User ID and Group ID modification #28

Closed
wants to merge 1 commit into from

Conversation

stormbyte
Copy link

Description

Add the possibility to modify the user and group ID of de www-data user inside the container.
This will create the functionality to match the operating user of the main system.
Allowing the Main system to edit the files without changing the permissions.

Related issues

Non

@karensg
Copy link

karensg commented Jun 30, 2023

This is actually beautiful. Would be great to see this in the main as well.

@ammannbe
Copy link

This fix don't work anymore and has multiple conflicts.
Is there another solution to map the local UID and GID?

@jawys
Copy link
Contributor

jawys commented Oct 11, 2023

@ammannbe
Copy link

I tried to remap the user but it doesn't seem to work either:

{
  "userns-remap": "myuser"
}

I like the solution of laravel/sail. They are able to map the local UID/GID automatically - and to override is also possible of course.

They have a startup/entrypoint script which makes a usermod's the applications user ID (in craft cms case this would be nginx).

Unfortunately I wasn't able to recreate something like that on my system (probably it has to do with the docker context I didn't get).

But I was able to create a custom image with hardcoded values:

FROM craftcms/nginx:8.2-dev

USER root

RUN set -ex \
    && apk upgrade --no-cache \
    && apk add --no-cache \
        shadow

RUN usermod -u 1000 www-data && groupmod -g 1000 www-data

RUN chown www-data /run/nginx.pid
RUN chown www-data /run/supervisord.pid
RUN chown -R www-data:www-data /var/lib/nginx/

USER www-data

My knowledge about docker is limited, so I'm not sure what would be the best solution to adjust the current implementation - and how to exactly build the craftcms/docker project itself on my system locally.

@ammannbe
Copy link

Nevermind, I've created a fork from laravel/sail and adjusted it so it works with craft perfectly.
https://github.com/ammannbe/craft-sail

@stormbyte stormbyte closed this Jan 7, 2024
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.

4 participants