itzg / docker-rcon-web-admin

A Docker image that runs rcon-web-admin
MIT License
92 stars 18 forks source link

Can not get RCON to connect to server #9

Open bobbyrabbit opened 3 years ago

bobbyrabbit commented 3 years ago

I'm new to docker and have managed to install a Creative and Survival server. I'm trying to RCON the Survival server, but connection is always refused. I have enabled RCON in the server.properties file using port 25566 with rcon.port=25576 and RCON is starting successfully.

I am attempting to run this command from terminal to setup rcon-web: docker run -d --name rcon-web -p 4326:4326 -p 4327:4327 -e RWA_PASSWORD=guipassword -e RWA_RCON_PASSWORD=minecraft -e RWA_RCON_PORT=25576 -e RWA_RCON_HOST=127.0.0.1 -e RWA_SERVER_NAME=mc2survival itzg/rcon

When checking the logs in portainer for rcon-web, I see: 2021-03-18T15:18:54.475Z RconServer [127.0.0.1:25576]: Connection failed

and error in the GUI of: The current selected server is not available anymore. Maybe gone offline?

Can anybody help with this, I've spent a day on it! My Daughter needs op'ing and I'm getting it in the neck :-) Thanks

itzg commented 3 years ago

Rather than docker runing them, it's use to use compose, such as

https://raw.githubusercontent.com/itzg/docker-rcon-web-admin/master/docker-compose.yml

however, a quick solution if you just want to run commands is exec'ing into the minecraft container such as

docker exec mc2survival rcon-cli op PLAYER_NAME

where I'm guessing mc2survival is the container name.

If you want to docker run the web app, add a network option to have that container re-use the network namespace of the minecraft container:

docker run -d --name rcon-web -p 4326:4326 -p 4327:4327 -e RWA_PASSWORD=guipassword -e RWA_RCON_PASSWORD=minecraft -e RWA_RCON_PORT=25576 -e RWA_RCON_HOST=127.0.0.1 -e RWA_SERVER_NAME=mc2survival --network container:mc2survival itzg/rcon
bobbyrabbit commented 3 years ago

Thanks for your reply. Really appreciated. Yes mc2survival is the container name.

On trying: docker exec mc2survival rcon-cli op PLAYER_NAME I receive error: Failed to connect to RCON serverdial tcp: lookup mc2survival on 213.133.99.99:53: no such host

When adding the network option I receive error: docker: Error response from daemon: conflicting options: port publishing and the container type network mode.

Thanks for your time.

itzg commented 3 years ago

Hmm, that's not the host nor class of IP address I expected there. How did you start your mc2survival container? If you don't have that handy, then output of docker inspect mc2survival might help.

Basically, this is how I typically do it

https://github.com/itzg/docker-minecraft-server#interacting-with-the-server

but something is different than I expect about your container.

bobbyrabbit commented 3 years ago

Thanks again. Running a docker exec does return that rather odd IP address, which is related to where my Dedicated Server is hosted!

I originally setup the container like so: docker run -d -it -p 25566:25566 --name mc2survival -e TZ=Europe/London -e TYPE=PAPER -e EULA=TRUE -e MODE=survival --restart=always -v /home/mc2survival/data:/data itzg/minecraft-server

Here is the result of docker inspect:

[ { "Id": "d7f43c58b6b395c3cc19d2f3f80b18df8fd9538ff39f298b95c1e088c06fe48b", "Created": "2021-03-18T14:55:52.134542957Z", "Path": "/start", "Args": [], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 2418146, "ExitCode": 0, "Error": "", "StartedAt": "2021-03-18T14:55:53.872947521Z", "FinishedAt": "0001-01-01T00:00:00Z", "Health": { "Status": "healthy", "FailingStreak": 0, "Log": [ { "Start": "2021-03-19T13:41:31.314982953Z", "End": "2021-03-19T13:41:31.410764894Z", "ExitCode": 0, "Output": "localhost:25566 : version=Paper 1.16.5 online=0 max=20 motd='Survival Server'" }, { "Start": "2021-03-19T13:42:01.556013776Z", "End": "2021-03-19T13:42:01.63767422Z", "ExitCode": 0, "Output": "localhost:25566 : version=Paper 1.16.5 online=0 max=20 motd='Survival Server'" }, { "Start": "2021-03-19T13:42:31.755632983Z", "End": "2021-03-19T13:42:31.859157508Z", "ExitCode": 0, "Output": "localhost:25566 : version=Paper 1.16.5 online=0 max=20 motd='Survival Server'" }, { "Start": "2021-03-19T13:43:01.96383623Z", "End": "2021-03-19T13:43:02.051708698Z", "ExitCode": 0, "Output": "localhost:25566 : version=Paper 1.16.5 online=0 max=20 motd='Survival Server'" }, { "Start": "2021-03-19T13:43:32.151827681Z", "End": "2021-03-19T13:43:32.234714955Z", "ExitCode": 0, "Output": "localhost:25566 : version=Paper 1.16.5 online=0 max=20 motd='Survival Server'" } ] } }, "Image": "sha256:96d6244fc4e4fbea95f93241c933cc315a23643aab33ceb635a533193641146c", "ResolvConfPath": "/var/lib/docker/containers/d7f43c58b6b395c3cc19d2f3f80b18df8fd9538ff39f298b95c1e088c06fe48b/resolv.conf", "HostnamePath": "/var/lib/docker/containers/d7f43c58b6b395c3cc19d2f3f80b18df8fd9538ff39f298b95c1e088c06fe48b/hostname", "HostsPath": "/var/lib/docker/containers/d7f43c58b6b395c3cc19d2f3f80b18df8fd9538ff39f298b95c1e088c06fe48b/hosts", "LogPath": "/var/lib/docker/containers/d7f43c58b6b395c3cc19d2f3f80b18df8fd9538ff39f298b95c1e088c06fe48b/d7f43c58b6b395c3cc19d2f3f80b18df8fd9538ff39f298b95c1e088c06fe48b-json.log", "Name": "/mc2survival", "RestartCount": 0, "Driver": "overlay2", "Platform": "linux", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "docker-default", "ExecIDs": null, "HostConfig": { "Binds": [ "/home/mc2survival/data:/data" ], "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": {} }, "NetworkMode": "bridge", "PortBindings": { "25566/tcp": [ { "HostIp": "", "HostPort": "25566" } ] }, "RestartPolicy": { "Name": "always", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "CapAdd": [ "AUDIT_WRITE", "CHOWN", "DAC_OVERRIDE", "FOWNER", "FSETID", "KILL", "MKNOD", "NET_BIND_SERVICE", "NET_RAW", "SETFCAP", "SETGID", "SETPCAP", "SETUID", "SYS_CHROOT" ], "CapDrop": [ "AUDIT_CONTROL", "BLOCK_SUSPEND", "DAC_READ_SEARCH", "IPC_LOCK", "IPC_OWNER", "LEASE", "LINUX_IMMUTABLE", "MAC_ADMIN", "MAC_OVERRIDE", "NET_ADMIN", "NET_BROADCAST", "SYSLOG", "SYS_ADMIN", "SYS_BOOT", "SYS_MODULE", "SYS_NICE", "SYS_PACCT", "SYS_PTRACE", "SYS_RAWIO", "SYS_RESOURCE", "SYS_TIME", "SYS_TTY_CONFIG", "WAKE_ALARM" ], "CgroupnsMode": "host", "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": [], "GroupAdd": null, "IpcMode": "private", "Cgroup": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "runc", "ConsoleSize": [ 0, 0 ], "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, "DeviceRequests": null, "KernelMemory": 0, "KernelMemoryTCP": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": null, "OomKillDisable": false, "PidsLimit": null, "Ulimits": null, "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0, "MaskedPaths": [ "/proc/asound", "/proc/acpi", "/proc/kcore", "/proc/keys", "/proc/latency_stats", "/proc/timer_list", "/proc/timer_stats", "/proc/sched_debug", "/proc/scsi", "/sys/firmware" ], "ReadonlyPaths": [ "/proc/bus", "/proc/fs", "/proc/irq", "/proc/sys", "/proc/sysrq-trigger" ] }, "GraphDriver": { "Data": { "LowerDir": "/var/lib/docker/overlay2/3715cdf44dd5a4676e2e1c3f4cda847cef1c916676188c89d0cb5aff63b8d645-init/diff:/var/lib/docker/overlay2/ae2b55cea15b8b97816cf447a0e0e765595341a280f817161a7da39124094661/diff:/var/lib/docker/overlay2/549fdc0c6b0810239c4c31bb90ead3b81f7e8f3bfc580c33b8d182fb59c03150/diff:/var/lib/docker/overlay2/b6a90497ce2b6d66466f5f1776485c86cdc43b840abeb13f56bf47fa3eee7344/diff:/var/lib/docker/overlay2/3e20b5bfcabb5c790749c0c02ebfb5cc349403a14339ba0a868a0798c77f9d4a/diff:/var/lib/docker/overlay2/32f0502f3423f0eee3cc75134f077f6acfaba74f97ffc0eca6d280e5bb0549ee/diff:/var/lib/docker/overlay2/64bf6cf3aadae5330adb83b6000c9a1a9435d2c01e8aac40dce4b86e41b33089/diff:/var/lib/docker/overlay2/bc678de8af9004ed8411f908802aaadb0d82c9b908aafa10b804c2ab7f0d8438/diff:/var/lib/docker/overlay2/1090553959b5b686633331f1ea4c28a3f093b363710818e23aa94fe3bf0ae07c/diff:/var/lib/docker/overlay2/30e13d4eaf1311acacf0ab5f5658e26b14b44f639383c38dd7f18ef2bc925259/diff:/var/lib/docker/overlay2/17d4580035cbc2b9c9d6988fbf83a42b329e912fb95af3b905203c068190e28f/diff:/var/lib/docker/overlay2/dbece14d2e8ec9598d9c77ca00fa9628b70c658813b2f95d9c7142ccd818d310/diff:/var/lib/docker/overlay2/bdf6af3f84a93ed7938e92dd18017912e5c3d93e0d69d585b9e9b4b0584ab84d/diff:/var/lib/docker/overlay2/c565157a8b5452545b623e86921abfa614e2170e120dd6337fd83da54541c777/diff:/var/lib/docker/overlay2/80c772b508fd1502c0de1c67772fe18b23b693c8c5f0a2ba038ccb91223df81d/diff:/var/lib/docker/overlay2/2fc74024f02123b3a16488d717f27ad240aefea0d82aa9ae32792161e41f7bce/diff:/var/lib/docker/overlay2/16857b9bb9611d3c4d1c69e5d48f60d4e3025f113ae664482c4534b5d6a79628/diff:/var/lib/docker/overlay2/f38c69592f10e78d511d81de60058a09243321b69f6419ffb8b89e758388bedc/diff:/var/lib/docker/overlay2/e9be4942bfb9c48c2db4f85db2dc4220ebac6dfdeaa03b5fec6c3b31dedb9288/diff:/var/lib/docker/overlay2/ed0005c00811c5486aeab2b64ad415d577cbb1ed1112b4a7eeedbae2db78d9a1/diff:/var/lib/docker/overlay2/f0587541e603851750e20449cd7724a4f2275b4ce209ef44d17fb47e109cb377/diff:/var/lib/docker/overlay2/85100392bf97565985e75fd18e38e4538d71232fdca62687a73a3b28c6d53ef7/diff:/var/lib/docker/overlay2/0b2bcc55512d074bbc01898e3f326afa804199369c28bd912de111810695f941/diff:/var/lib/docker/overlay2/90fb7a35b6c34e01a69fbe6f96ba4ded2dd0a30f58c23c61bb20da6cc217a42e/diff", "MergedDir": "/var/lib/docker/overlay2/3715cdf44dd5a4676e2e1c3f4cda847cef1c916676188c89d0cb5aff63b8d645/merged", "UpperDir": "/var/lib/docker/overlay2/3715cdf44dd5a4676e2e1c3f4cda847cef1c916676188c89d0cb5aff63b8d645/diff", "WorkDir": "/var/lib/docker/overlay2/3715cdf44dd5a4676e2e1c3f4cda847cef1c916676188c89d0cb5aff63b8d645/work" }, "Name": "overlay2" }, "Mounts": [ { "Type": "bind", "Source": "/home/mc2survival/data", "Destination": "/data", "Mode": "", "RW": true, "Propagation": "rprivate" } ], "Config": { "Hostname": "ad38d19ed4cb", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "25565/tcp": {}, "25566/tcp": {}, "25575/tcp": {} }, "Tty": true, "OpenStdin": true, "StdinOnce": false, "Env": [ "TZ=Europe/London", "TYPE=PAPER", "EULA=TRUE", "MODE=survival", "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=8u212", "JAVA_ALPINE_VERSION=8.212.04-r0", "UID=1000", "GID=1000", "JVM_XX_OPTS=-XX:+UseG1GC", "MEMORY=1G", "VERSION=LATEST", "FORGEVERSION=RECOMMENDED", "SPONGEBRANCH=STABLE", "FABRICVERSION=LATEST", "LEVEL=world", "PVP=true", "DIFFICULTY=easy", "ENABLE_RCON=true", "RCON_PORT=25576", "RCON_PASSWORD=minecraft", "LEVEL_TYPE=DEFAULT", "SERVER_PORT=25566", "ONLINE_MODE=TRUE", "SERVER_NAME=Dedicated Server", "ENABLE_AUTOPAUSE=false", "AUTOPAUSE_TIMEOUT_EST=3600", "AUTOPAUSE_TIMEOUT_KN=120", "AUTOPAUSE_TIMEOUT_INIT=600", "AUTOPAUSE_PERIOD=10", "LANGUAGE=en_US:en", "LC_ALL=en_US.UTF-8", "AUTOPAUSE_KNOCK_INTERFACE=eth0", "RCON_HOST=mc2survival" ], "Cmd": null, "Healthcheck": { "Test": [ "CMD-SHELL", "/health.sh" ], "StartPeriod": 60000000000 }, "Image": "itzg/minecraft-server:latest", "Volumes": { "/data": {} }, "WorkingDir": "/data", "Entrypoint": [ "/start" ], "OnBuild": null, "Labels": { "org.opencontainers.image.authors": "Geoff Bourne itzgeoff@gmail.com", "org.opencontainers.image.created": "2020-12-16T02:42:23Z", "org.opencontainers.image.documentation": "https://github.com/itzg/docker-minecraft-server", "org.opencontainers.image.revision": "f613228619c6a3d2e4a3ad39c595f966cc1e7c31", "org.opencontainers.image.source": "https://github.com/itzg/docker-minecraft-server", "org.opencontainers.image.url": "https://github.com/itzg/docker-minecraft-server", "org.opencontainers.image.version": "latest" } }, "NetworkSettings": { "Bridge": "", "SandboxID": "89129e211f5179fe3b5054b29c77d37e43e4e0c9f1d24223eb20e30e01ed05c5", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "25565/tcp": null, "25566/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "25566" } ], "25575/tcp": null }, "SandboxKey": "/var/run/docker/netns/89129e211f51", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "206d5cb72a0dd89057327d5aed5c96d3d9155e64581c0d27c66bf4e31df1800b", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "MacAddress": "HIDDEN", "Networks": { "bridge": { "IPAMConfig": {}, "Links": null, "Aliases": null, "NetworkID": "6cceb6b2ced20c6b7b662d25edff0247bf54efaec0b83548e53ed1f808e25f4b", "EndpointID": "206d5cb72a0dd89057327d5aed5c96d3d9155e64581c0d27c66bf4e31df1800b", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "HIDDEN", "DriverOpts": null } } } } ]

itzg commented 3 years ago

Actually, it looks like you must have included -e RCON_HOST=mc2survival in your container command-line. That really should be left as the default "localhost"...in fact I can't remember off hand why it's even configurable.

bobbyrabbit commented 3 years ago

I changed RCON_HOST to localhost and now I can RCON in. Thank you so much