mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-07-17 05:54:55 +00:00
Merge pull request #57 from Jadaw1n/master
[minecraft] Pass GID as docker option
This commit is contained in:
@@ -34,7 +34,7 @@ CMD [ "/start" ]
|
|||||||
# Special marker ENV used by MCCY management tool
|
# Special marker ENV used by MCCY management tool
|
||||||
ENV MC_IMAGE=YES
|
ENV MC_IMAGE=YES
|
||||||
|
|
||||||
ENV UID=1000
|
ENV UID=1000 GID=1000
|
||||||
ENV MOTD A Minecraft Server Powered by Docker
|
ENV MOTD A Minecraft Server Powered by Docker
|
||||||
ENV JVM_OPTS -Xmx1024M -Xms1024M
|
ENV JVM_OPTS -Xmx1024M -Xms1024M
|
||||||
ENV TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \
|
ENV TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \
|
||||||
|
|||||||
@@ -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`
|
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.
|
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.
|
**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 by passing the option:
|
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.
|
replacing 1000 with a UID and GID that is present on the host.
|
||||||
Here is one way to find the UID given a username:
|
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
|
## Versions
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
umask 002
|
||||||
|
|
||||||
if [ ! -e /data/eula.txt ]; then
|
if [ ! -e /data/eula.txt ]; then
|
||||||
if [ "$EULA" != "" ]; then
|
if [ "$EULA" != "" ]; then
|
||||||
echo "# Generated via Docker on $(date)" > eula.txt
|
echo "# Generated via Docker on $(date)" > eula.txt
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
usermod --uid $UID minecraft
|
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
|
while lsof -- /start-minecraft; do
|
||||||
echo -n "."
|
echo -n "."
|
||||||
|
|||||||
Reference in New Issue
Block a user