[minecraft] Pass GID as docker option

This commit is contained in:
Piero Steinger 2016-01-29 20:50:53 +01:00
parent 13ee106dac
commit 70a55e3be1
4 changed files with 14 additions and 8 deletions

View file

@ -34,7 +34,7 @@ CMD [ "/start" ]
# Special marker ENV used by MCCY management tool
ENV MC_IMAGE=YES
ENV UID=1000
ENV UID=1000 GID=1000
ENV MOTD A Minecraft Server Powered by Docker
ENV JVM_OPTS -Xmx1024M -Xms1024M
ENV TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \

View file

@ -68,15 +68,16 @@ to map a directory on your host machine to the container's `/data` directory, su
When attached in this way you can stop the server, edit the configuration under your attached `/path/on/host`
and start the server again with `docker start CONTAINERID` to pick up the new configuration.
**NOTE**: By default, the files in the attached directory will be owned by the host user with UID of 1000.
You can use an different UID by passing the option:
**NOTE**: By default, the files in the attached directory will be owned by the host user with UID of 1000 and host group with GID of 1000.
You can use an different UID and GID by passing the options:
-e UID=1000
-e UID=1000 -e GID=1000
replacing 1000 with a UID that is present on the host.
Here is one way to find the UID given a username:
replacing 1000 with a UID and GID that is present on the host.
Here is one way to find the UID and GID:
grep some_host_user /etc/passwd|cut -d: -f3
id some_host_user
getent group some_host_group
## Versions

View file

@ -1,5 +1,7 @@
#!/bin/bash
umask 002
if [ ! -e /data/eula.txt ]; then
if [ "$EULA" != "" ]; then
echo "# Generated via Docker on $(date)" > eula.txt

View file

@ -2,7 +2,10 @@
set -e
usermod --uid $UID minecraft
chown -R minecraft /data /start-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 "."