mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2024-11-10 12:47:24 +01:00
Allowing non-root user to run factorio
When starting the container with `docker run -d -u $(id -u factorio):$(id -g factorio) ...`, permission is denied upon trying to create `/opt/factorio/.lock` file. This permission tweak will allow caller to pass desired user from host to container such that the permissions are retained correctly when games are saved to the mount. Also, it just feels wrong to run factorio as root, container or not. :)
This commit is contained in:
parent
7a5f3471d6
commit
7a276adb3c
@ -14,6 +14,7 @@ RUN mkdir /opt && \
|
|||||||
-o /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
-o /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
||||||
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c && \
|
echo "$SHA1 /tmp/factorio_headless_x64_$VERSION.tar.xz" | sha1sum -c && \
|
||||||
tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt && \
|
tar xf /tmp/factorio_headless_x64_$VERSION.tar.xz --directory /opt && \
|
||||||
|
chmod -R ugo=rwx /opt/factorio && \
|
||||||
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
rm /tmp/factorio_headless_x64_$VERSION.tar.xz && \
|
||||||
ln -s /factorio/saves /opt/factorio/saves && \
|
ln -s /factorio/saves /opt/factorio/saves && \
|
||||||
ln -s /factorio/mods /opt/factorio/mods && \
|
ln -s /factorio/mods /opt/factorio/mods && \
|
||||||
@ -24,6 +25,7 @@ VOLUME /factorio
|
|||||||
EXPOSE $PORT/udp $RCON_PORT/tcp
|
EXPOSE $PORT/udp $RCON_PORT/tcp
|
||||||
|
|
||||||
COPY ./docker-entrypoint.sh /
|
COPY ./docker-entrypoint.sh /
|
||||||
|
RUN chmod +x /docker-entrypoint.sh
|
||||||
|
|
||||||
ENTRYPOINT ["/sbin/tini", "--"]
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
CMD ["/docker-entrypoint.sh"]
|
CMD ["/docker-entrypoint.sh"]
|
||||||
|
Loading…
Reference in New Issue
Block a user