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

non-root run #98

Open
casperdcl opened this issue Oct 8, 2024 · 2 comments
Open

non-root run #98

casperdcl opened this issue Oct 8, 2024 · 2 comments

Comments

@casperdcl
Copy link
Contributor

casperdcl commented Oct 8, 2024

potentially worth documenting how to run as non-root users (related: caddyserver/caddy-docker#104)?

I had to do:

FROM wemakeservices/caddy-gen:latest
ARG CADDY_UID=1000
ARG CADDY_GID=1000
RUN chown -R $CADDY_UID:$CADDY_GID /etc/caddy /config/caddy /code/docker-gen/templates/Caddyfile.tmpl
RUN chmod a+x /usr/bin/forego
USER $CADDY_UID:$CADDY_GID

which allows building using e.g. --arg CADDY_GID=$(getent group docker | cut -d: -f3) --arg CADDY_UID=$(id -u)

@sobolevn
Copy link
Member

sobolevn commented Oct 8, 2024

I think that we can try adding this to the base image 🤔

@casperdcl
Copy link
Contributor Author

casperdcl commented Oct 8, 2024

apart from chmod a+x /usr/bin/forego, this won't really affect the base image... the CADDY_UID, CADDY_GID must be overridden by the user.

Alternatively, I suppose the "correct" way is to have:

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

2 participants