-
Notifications
You must be signed in to change notification settings - Fork 104
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
Run container as terraria user #34
Conversation
Hey @mattlorimor Because when I add a volume linked to the /home path and upload the file, it is done as root user and I am not sure if things then go well if the file isn't changed to the correct uID/gID outside the container, e. g. for write access or doesn't this matter? |
Ugh, so I had merged this, but had to make a commit to undo it. When I was testing, I was getting a lot of crashing due to tshock failing permissions to write to a volume. After some googling, I think it is related to moby/moby#2259 (comment). No matter what I did to change the permissions on directories that are volumed, they are stuck at root. My linux-foo isn't the strongest though so maybe you guys have a better idea? |
@ryansheehan - What did the |
I dropped a text file into the ServerPlugins directory to test the copy |
The same permissions discrepancies can be seen with a small, test Dockerfile: FROM alpine
RUN mkdir /test && \
chown -R nobody:nobody /test
USER nobody
VOLUME ['/test'] |
Maybe this could help out: https://github.com/TeamSpeak-Systems/teamspeak-linux-docker-images/blob/master/alpine/Dockerfile#L4-L7 - I have no problems with my TS3-Setup And this one too: https://github.com/TeamSpeak-Systems/teamspeak-linux-docker-images/blob/master/alpine/entrypoint.sh#L4-L8 Hope, that I could help out a bit :) |
Thanks for that, @Chaoschaot232. It should be easy enough to change the RUN groupadd -r -g 999 terraria && \
useradd -m -r -u 999 -g terraria terraria And modify all the But I think the issue @ryansheehan is encountering is a little different. I'm trying to understand why it sounds like the container process couldn't even write to the volumes when I'm not seeing the same thing. My run command should be functionally the same:
|
I think, at this point, I'd need to see what Ryan's error output looks like. And what Docker version they're using and on what system (Windows? macOS? Ubuntu?). |
If you get a chance, see if this NonRoot branch of mine does what you want: https://github.com/mattlorimor/terraria-1/tree/NonRoot. It creates the The |
I wish I could move this into a new PR. I'm struggling to keep up with all the TShock updates and issues being posted. Oh and Terraria itself released a 1.4.0.3 update! I'll try and take a look at this soon. When I was last trying, on linux, all volumes connected as root, and no amount of chown/chmod was getting me around the permission errors that TerrariaServer.exe was blowing up on. |
This potentially closes #17.
I'm not sure if this is how you would like to accomplish this (so I'm creating this as a draft), but there doesn't appear to be any reason to run the container as root at all. It's possible to avoid even having to specify
-u [user]
when doing adocker run
and simply use a non-root user by default.This PR:
terraria
user and groupchown
s the necessary directoriesUSER terraria
at the end of the DockerfileQA
I've built this locally, and the container:
docker run
command line-world
arg