mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
[mc] Putting back usermod solution
This commit is contained in:
parent
b15ad9e799
commit
03d9064b35
@ -5,7 +5,7 @@ MAINTAINER itzg
|
||||
ENV APT_GET_UPDATE 2015-10-03
|
||||
RUN apt-get update
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libmozjs-24-bin imagemagick lsof && apt-get clean
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libmozjs-24-bin imagemagick lsof sudo && apt-get clean
|
||||
RUN update-alternatives --install /usr/bin/js js /usr/bin/js24 100
|
||||
|
||||
RUN wget -O /usr/bin/jsawk https://github.com/micha/jsawk/raw/master/jsawk
|
||||
@ -19,6 +19,7 @@ RUN useradd -M -s /bin/false --uid 1000 minecraft \
|
||||
|
||||
EXPOSE 25565
|
||||
|
||||
COPY start.sh /start
|
||||
COPY start-minecraft.sh /start-minecraft
|
||||
|
||||
VOLUME ["/data"]
|
||||
@ -28,8 +29,7 @@ VOLUME ["/plugins"]
|
||||
COPY server.properties /tmp/server.properties
|
||||
WORKDIR /data
|
||||
|
||||
USER minecraft
|
||||
CMD [ "/start-minecraft" ]
|
||||
CMD [ "/start" ]
|
||||
|
||||
# Special marker ENV used by MCCY management tool
|
||||
ENV MC_IMAGE=YES
|
||||
|
15
minecraft-server/start.sh
Executable file
15
minecraft-server/start.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
usermod --uid $UID minecraft
|
||||
groupmod --gid $GID minecraft
|
||||
|
||||
chown -R minecraft:minecraft /data /start-minecraft
|
||||
chmod -R g+wX /data /start-minecraft
|
||||
|
||||
while lsof -- /start-minecraft; do
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
echo "...switching to user 'minecraft'"
|
||||
exec sudo -E -u minecraft /start-minecraft
|
Loading…
Reference in New Issue
Block a user