mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-09-21 05:08:30 +00:00
[mc] Putting back usermod solution
This commit is contained in:
@@ -5,7 +5,7 @@ MAINTAINER itzg
|
|||||||
ENV APT_GET_UPDATE 2015-10-03
|
ENV APT_GET_UPDATE 2015-10-03
|
||||||
RUN apt-get update
|
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 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
|
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
|
EXPOSE 25565
|
||||||
|
|
||||||
|
COPY start.sh /start
|
||||||
COPY start-minecraft.sh /start-minecraft
|
COPY start-minecraft.sh /start-minecraft
|
||||||
|
|
||||||
VOLUME ["/data"]
|
VOLUME ["/data"]
|
||||||
@@ -28,8 +29,7 @@ VOLUME ["/plugins"]
|
|||||||
COPY server.properties /tmp/server.properties
|
COPY server.properties /tmp/server.properties
|
||||||
WORKDIR /data
|
WORKDIR /data
|
||||||
|
|
||||||
USER minecraft
|
CMD [ "/start" ]
|
||||||
CMD [ "/start-minecraft" ]
|
|
||||||
|
|
||||||
# Special marker ENV used by MCCY management tool
|
# Special marker ENV used by MCCY management tool
|
||||||
ENV MC_IMAGE=YES
|
ENV MC_IMAGE=YES
|
||||||
|
|||||||
Executable
+15
@@ -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
|
||||||
Reference in New Issue
Block a user