itzg / docker-minecraft-server

Docker image that provides a Minecraft Server that will automatically download selected version at startup
https://docker-minecraft-server.readthedocs.io/
Apache License 2.0
9.55k stars 1.56k forks source link

Configuration reset to default upon start unless restarted #265

Closed bbaraniec closed 2 years ago

bbaraniec commented 5 years ago

Hi there,

I'm running docker for Windows on Windows 10 1809. Docker start automatically with Windows and then starts the Minecraft Classic. I've run docker with -v option for and mounting d:/mc:/data Issue that I'm having always after Windows restart docker start with default config. Server.properties will be set to default, ops.json and whitelist.json will be wiped out. While checking those files on host Windows machine they have proper values. I have to manually do: docker restart mc in order to get those files updated. Any idea what might be causing it?

itzg commented 5 years ago

That’s strange that it works as expected after a docker restart. If you don’t mind, can you post the output of docker inspect mc when it does that?

bbaraniec commented 5 years ago

Hi,

Thank you for your time. Below you will find as output as Windows and docker just started.

[ { "Id": "83a688ba4aae6b375c4d56b7ef7ee7afb08c0d50831c9bc34db646d79434afa4", "Created": "2018-12-10T21:21:13.0121742Z", "Path": "/start", "Args": [], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 2381, "ExitCode": 0, "Error": "", "StartedAt": "2018-12-12T15:25:00.458552Z", "FinishedAt": "2018-12-12T15:24:58.5133146Z", "Health": { "Status": "healthy", "FailingStreak": 0, "Log": [ { "Start": "2018-12-10T22:53:56.7029843Z", "End": "2018-12-10T22:53:56.902557Z", "ExitCode": 0, "Output": "3.662ms\n" }, { "Start": "2018-12-10T22:54:26.9112399Z", "End": "2018-12-10T22:54:27.109486Z", "ExitCode": 0, "Output": "2.625ms\n" }, { "Start": "2018-12-10T22:55:27.5096535Z", "End": "2018-12-10T22:55:27.804219Z", "ExitCode": 0, "Output": "90.016ms\n" }, { "Start": "2018-12-10T22:55:57.8152161Z", "End": "2018-12-10T22:55:58.0145494Z", "ExitCode": 0, "Output": "2.6ms\n" }, { "Start": "2018-12-12T15:25:30.4589784Z", "End": "2018-12-12T15:25:31.3059819Z", "ExitCode": 0, "Output": "196.528ms\n" } ] } }, "Image": "sha256:0a448b7cfa390e6b137674b12ddc1b09cf32d7929b68619359cf4b7cf5417685", "ResolvConfPath": "/var/lib/docker/containers/83a688ba4aae6b375c4d56b7ef7ee7afb08c0d50831c9bc34db646d79434afa4/resolv.conf", "HostnamePath": "/var/lib/docker/containers/83a688ba4aae6b375c4d56b7ef7ee7afb08c0d50831c9bc34db646d79434afa4/hostname", "HostsPath": "/var/lib/docker/containers/83a688ba4aae6b375c4d56b7ef7ee7afb08c0d50831c9bc34db646d79434afa4/hosts", "LogPath": "/var/lib/docker/containers/83a688ba4aae6b375c4d56b7ef7ee7afb08c0d50831c9bc34db646d79434afa4/83a688ba4aae6b375c4d56b7ef7ee7afb08c0d50831c9bc34db646d79434afa4-json.log", "Name": "/mc", "RestartCount": 0, "Driver": "overlay2", "Platform": "linux", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "", "ExecIDs": null, "HostConfig": { "Binds": [ "/host_mnt/d/MC:/data" ], "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": {} }, "NetworkMode": "default", "PortBindings": { "25565/tcp": [ { "HostIp": "", "HostPort": "25565" } ] }, "RestartPolicy": { "Name": "unless-stopped", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "CapAdd": null, "CapDrop": null, "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": null, "GroupAdd": null, "IpcMode": "shareable", "Cgroup": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "runc", "ConsoleSize": [ 37, 180 ], "Isolation": "", "CpuShares": 0, "Memory": 0, "NanoCpus": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": [], "BlkioDeviceReadBps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteIOps": null, "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [], "DeviceCgroupRules": null, "DiskQuota": 0, "KernelMemory": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": null, "OomKillDisable": false, "PidsLimit": 0, "Ulimits": null, "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0, "MaskedPaths": [ "/proc/acpi", "/proc/kcore", "/proc/keys", "/proc/latency_stats", "/proc/timer_list", "/proc/timer_stats", "/proc/sched_debug", "/proc/scsi", "/sys/firmware" ], "ReadonlyPaths": [ "/proc/asound", "/proc/bus", "/proc/fs", "/proc/irq", "/proc/sys", "/proc/sysrq-trigger" ] }, "GraphDriver": { "Data": { "LowerDir": "/var/lib/docker/overlay2/30efbbbf3ad2b93c437ded223efc5dce6596e29d834d89e04e7d8b9ab512ed74-init/diff:/var/lib/docker/overlay2/c7fc836003808d8369a907878cf29e36411407539b453ac4a28a70a20436dfd3/diff:/var/lib/docker/overlay2/477665e866d6d7ada2dbf45e2e1fda87090fcf1629968b94b5a0c502caad6e59/diff:/var/lib/docker/overlay2/5df72335b7c2d083b47f53e3d36d919c881fe7825d2d09e7e66cff242a84fdde/diff:/var/lib/docker/overlay2/dd45df7af80f86a3d36598b2fdeb405c50b64e07bedad862c67c475189d3b3b7/diff:/var/lib/docker/overlay2/7e4389c8d35430c33c0a086168e05c08af4f0039bba78f16030f7e971d5a4283/diff:/var/lib/docker/overlay2/779a6352222403d631dc900e56a338476acc91fdefc5d974f766d5a4afd395a0/diff:/var/lib/docker/overlay2/bf6b0e343ffeaad5ad95c571ab6ecbd52bedaf91374f531c2345b4b304d565af/diff:/var/lib/docker/overlay2/f2553d3a4404ae522b6b14fb0f3dee5adc664e5e79f804bb3a25d880ad6ed399/diff:/var/lib/docker/overlay2/f9fbde62d97ae368b17bccaa778c22cf5317a9d514f96019419b3b796c706ff2/diff:/var/lib/docker/overlay2/bb0a0fde89cf00afde51910f64081661ceaef3fe76ec5672a0aa49405b64bb25/diff:/var/lib/docker/overlay2/be547404ba39262152f7c7e84ee7721bc8b9fbea3f629f1217177a1ce2fb6622/diff:/var/lib/docker/overlay2/095988bef9713c161fe4a7613e32e89a1ba16779592737fbff05c08879c86ac3/diff:/var/lib/docker/overlay2/fdd0120f9cd8c243e85e0bdfc497b3176e8a63de3b7f43a5bf13b887af4172ea/diff:/var/lib/docker/overlay2/3f0c9a595266539633d146b055b54ec1a070103059f5d859a0f395d36ef4ce4c/diff:/var/lib/docker/overlay2/f92786e87df017a94a63ae626da8529bc7c04da748b0e205f9fc26c676ca639b/diff:/var/lib/docker/overlay2/21beaf69fb170ba582f544b3ab76bbe3cdf1b313468411bb9e68366600fda4ff/diff", "MergedDir": "/var/lib/docker/overlay2/30efbbbf3ad2b93c437ded223efc5dce6596e29d834d89e04e7d8b9ab512ed74/merged", "UpperDir": "/var/lib/docker/overlay2/30efbbbf3ad2b93c437ded223efc5dce6596e29d834d89e04e7d8b9ab512ed74/diff", "WorkDir": "/var/lib/docker/overlay2/30efbbbf3ad2b93c437ded223efc5dce6596e29d834d89e04e7d8b9ab512ed74/work" }, "Name": "overlay2" }, "Mounts": [ { "Type": "volume", "Name": "2f9e9db24de6be6f9d2d35c42392553a7373b3acd443743dc3af22c845fcc61d", "Source": "/var/lib/docker/volumes/2f9e9db24de6be6f9d2d35c42392553a7373b3acd443743dc3af22c845fcc61d/_data", "Destination": "/config", "Driver": "local", "Mode": "", "RW": true, "Propagation": "" }, { "Type": "bind", "Source": "/host_mnt/d/MC", "Destination": "/data", "Mode": "", "RW": true, "Propagation": "rprivate" }, { "Type": "volume", "Name": "af9645ebc5f06857b95997e180eaac7d5e093d5b622dce81e9f583e96a309ce0", "Source": "/var/lib/docker/volumes/af9645ebc5f06857b95997e180eaac7d5e093d5b622dce81e9f583e96a309ce0/_data", "Destination": "/mods", "Driver": "local", "Mode": "", "RW": true, "Propagation": "" }, { "Type": "volume", "Name": "4b545930d72b453c232630da44f93511f101c823a419bc0768b8f1630aefb04c", "Source": "/var/lib/docker/volumes/4b545930d72b453c232630da44f93511f101c823a419bc0768b8f1630aefb04c/_data", "Destination": "/plugins", "Driver": "local", "Mode": "", "RW": true, "Propagation": "" } ], "Config": { "Hostname": "83a688ba4aae", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "25565/tcp": {}, "25575/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "EULA=TRUE", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin", "LANG=C.UTF-8", "JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk/jre", "JAVA_VERSION=8u171", "JAVA_ALPINE_VERSION=8.171.11-r0", "UID=1000", "GID=1000", "JVM_XX_OPTS=-XX:+UseG1GC", "MEMORY=1G", "TYPE=VANILLA", "VERSION=LATEST", "FORGEVERSION=RECOMMENDED", "SPONGEBRANCH=STABLE", "SPONGEVERSION=", "LEVEL=world", "PVP=true", "DIFFICULTY=easy", "ENABLE_RCON=true", "RCON_PORT=25575", "RCON_PASSWORD=minecraft", "LEVEL_TYPE=DEFAULT", "GENERATOR_SETTINGS=", "WORLD=", "MODPACK=", "MODS=", "SERVER_PORT=25565", "ONLINE_MODE=TRUE", "CONSOLE=true" ], "Cmd": null, "Healthcheck": { "Test": [ "CMD-SHELL", "mcstatus localhost:$SERVER_PORT ping" ] }, "ArgsEscaped": true, "Image": "itzg/minecraft-server", "Volumes": { "/config": {}, "/data": {}, "/mods": {}, "/plugins": {} }, "WorkingDir": "/data", "Entrypoint": [ "/start" ], "OnBuild": null, "Labels": { "maintainer": "itzg" } }, "NetworkSettings": { "Bridge": "", "SandboxID": "efd464f4852dabc788d6dd878d4585307238bb7c3a06d66d2706fbf53b4be7a5", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "25565/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "25565" } ], "25575/tcp": null }, "SandboxKey": "/var/run/docker/netns/efd464f4852d", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "69c346f7972cb173d850738a540f0172c0ad4e0efe5ca6076389e95738c9bccb", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "MacAddress": "02:42:ac:11:00:02", "Networks": { "bridge": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "1bc381b68676c9e038f65aa7aada590157b77ed3a8606d7a07a4c319320c6e04", "EndpointID": "69c346f7972cb173d850738a540f0172c0ad4e0efe5ca6076389e95738c9bccb", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:02", "DriverOpts": null } } } } ] Now check the server.properties and json files: `C:\Users\Bartek>docker exec -it mc bash bash-4.4# cat /data/ops.json []bash-4.4# cat /data/whitelist.json bash-4.4# cat /data/server.properties

Minecraft server properties

Wed Dec 12 15:25:47 UTC 2018

spawn-protection=16 max-tick-time=60000 query.port=25565 generator-settings= force-gamemode=false allow-nether=true enforce-whitelist=false gamemode=0 enable-query=false player-idle-timeout=0 difficulty=1 spawn-monsters=true op-permission-level=4 pvp=true snooper-enabled=true level-type=DEFAULT hardcore=false enable-command-block=true network-compression-threshold=256 max-players=20 resource-pack-sha1= max-world-size=29999984 rcon.port=25575 server-port=25565 texture-pack= server-ip= spawn-npcs=true allow-flight=false level-name=world view-distance=10 resource-pack= spawn-animals=true white-list=false rcon.password=minecraft generate-structures=true online-mode=true max-build-height=256 level-seed= use-native-transport=true prevent-proxy-connections=false motd=A Vanilla Minecraft Server powered by Docker enable-rcon=true bash-4.4#

Now restarting:

C:\Users\Bartek>docker restart mc mc

C:\Users\Bartek>docker exec -it mc bash bash-4.4# cat /data/ops.json [ { "uuid": "redacted", "name": "redacted", "level": 1, "bypassesPlayerLimit": true }, { "uuid": "redacted", "name": "redacted", "level": 3, "bypassesPlayerLimit": true } ]bash-4.4#cat /data/whitelist.json [ { "uuid": "redacted", "name": "redacted" }, { "uuid": "redacted", "name": "redacted" } ]bash-4.4# cat /data/server.properties

Minecraft server properties

Wed Dec 12 15:30:26 UTC 2018

spawn-protection=16 max-tick-time=60000 query.port=25565 generator-settings= force-gamemode=false allow-nether=true enforce-whitelist=false gamemode=1 broadcast-console-to-ops=true enable-query=false player-idle-timeout=0 difficulty=1 spawn-monsters=false op-permission-level=4 pvp=false snooper-enabled=true level-type=DEFAULT hardcore=false enable-command-block=true max-players=20 network-compression-threshold=256 resource-pack-sha1= max-world-size=29999984 rcon.port=25575 server-port=25565 texture-pack= server-ip= spawn-npcs=true allow-flight=true level-name=world view-distance=10 resource-pack= spawn-animals=true white-list=true rcon.password=minecraft generate-structures=true max-build-height=256 online-mode=true level-seed= prevent-proxy-connections=false use-native-transport=true enable-rcon=true motd=Minecraft Classic powered by`

itzg commented 5 years ago

Thanks. The interesting bit is

{ "Type": "bind", "Source": "/host_mnt/d/MC", "Destination": "/data", "Mode": "", "RW": true, "Propagation": "rprivate" }

and I'm wondering if there's some startup/race condition where the Docker HyperV VM hasn't yet attached its volume mount from /host_mnt/d/MC to your actual D:\MC path at that point. It would be ideal if Docker had a way to delay the startup of the containers when the whole system is first started...

bbaraniec commented 5 years ago

I've tried I think everything. If there is any race condition I can't find it.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Please add a comment describing the reason to keep this issue open.

riconeitzel commented 1 year ago

well … I do have a similar issue 😄 no solution so far? My rcon port all the time. Starting the container -> rcon port was initially set to 25575 … changed it to 25576 -> saved -> restart container -> rcon.port setting is reverted.

FUNNY tho is, that all the other settings persist …