Skip to content

Conversation

flexd
Copy link

@flexd flexd commented Sep 9, 2025

Hi there!

I made it so you can specify PUID/PGID when starting this container, fixing #14.

TLDR; Add the openttd user as normal, but run a new entrypoint as root which changes the uid/gid on "openttd" to the specified ones and then drops privileges to that user and runs the original entrypoint

I took some inspiration from how LinuxServers do it [1] , and also this Dockerfile/entrypoint where gosu was used https://github.com/sudo-bmitch/jenkins-docker/tree/main

Using gosu seems to be common practice [3]

[1] https://github.com/linuxserver/docker-baseimage-ubuntu/blob/focal/root/etc/s6-overlay/s6-rc.d/init-adduser/run
[2] (https://github.com/tianon/gosu?tab=readme-ov-file#gosu
[3] https://denibertovic.com/posts/handling-permissions-with-docker-volumes/

@flexd
Copy link
Author

flexd commented Sep 16, 2025

@duckfullstop Mentioning you in case you didn't see this :)

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.

1 participant