-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
Would there be a way to implement a variable for User:Group rather than listing it in the docker run command?
Right now, all downloads save as root, and it might be worthwhile seeing if there's a way to make the container run as non-root + a variable to set what user it saves files as.
Currently, I'm running:
docker run --user 1000:997 --volume /my/backup/path/GitBackup:/backups ghcr.io/chappio/git-backup
This would not only secure the container by running it as non-root, but also allow for users to define a specific user + group to allow for easier data management.
I suspect that it might be doable by setting the dockerfile to have a USER
value, and a ENV value, e.g.:
ENV UID=1000 \
PID=1000 \
COPY --chown=$UID:$PID=${TARGETPLATFORM}/git-backup / #COPY is a better choice than ADD in this scenario
RUN chmod +x /git-backup
USER $UID:$PID
The above is totally untested.
Metadata
Metadata
Assignees
Labels
No labels