Velocity not recognizing docker container name as valid IP.
SpookyKipper opened this issue · 5 comments
SpookyKipper commented
I got error that Velocity is not accepting docker container name as IP:
[04:59:32 ERROR]: Unable to read/load/save your velocity.toml. The server will shut down.
java.lang.IllegalStateException: Invalid hostname/IP nameless_mc_1:25565
at com.velocitypowered.proxy.util.AddressUtil.parseAddress(AddressUtil.java:44) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at com.velocitypowered.proxy.config.VelocityConfiguration.validate(VelocityConfiguration.java:160) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at com.velocitypowered.proxy.VelocityServer.doStartupConfigLoad(VelocityServer.java:310) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at com.velocitypowered.proxy.VelocityServer.start(VelocityServer.java:214) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at com.velocitypowered.proxy.Velocity.main(Velocity.java:64) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
If you need my configurations, it's below. The reason i use Custom is that the jar download will fail if i use TYPE=VELOCITY then specific the build number and version etc.
velocity.toml:
[servers]
# Configure your servers here. Each key represents the server's name, and the value
# represents the IP address of the server to connect to.
Main = "nameless_mc_1:25565"
#factions = "127.0.0.1:30067"
#minigames = "127.0.0.1:30068"
# In what order we should try servers when a player logs in or is kicked from a server.
try = [
"Main"
]docker-compose.yml:
version: "3"
services:
mc:
image: itzg/minecraft-server
ports:
- 25566:25565
environment:
UID: 1002
GID: 1002
EULA: "TRUE"
TYPE: "PAPER"
PAPERBUILD: 379
VERSION: 1.18.2
ONLINE_MODE: "FALSE"
INIT_MEMORY: "4G"
MAX_MEMORY: "10G"
ENABLE_COMMAND_BLOCK: "TRUE"
GAMEMODE: "SURVIVAL"
LEVEL-NAME: "SurvivalWorld"
SPAWN-MONSTERS: "TRUE"
tty: true
stdin_open: true
restart: unless-stopped
volumes:
# attach a directory relative to the directory containing this compose file
- ./mc-data:/data
db:
image: mariadb
volumes:
- "./db:/var/lib/mysql"
user: '1002' # change this
environment:
MYSQL_ROOT_PASSWORD: xxx
MYSQL_USER: xxx
MYSQL_PASSWORD: xxx
MYSQL_DATABASE: xxx
restart: unless-stopped
networks:
- net_kipper_ml
velocity-proxy:
image: itzg/bungeecord
user: "1002:1002"
stdin_open: true # docker run -i
tty: true # docker run -t
environment:
UID: 1002
GID: 1002
REPLACE_ENV_VARIABLES: "true"
TYPE: "CUSTOM"
INIT_MEMORY: "1G"
MAX_MEMORY: "2G"
BUNGEE_JAR_URL: "https://api.papermc.io/v2/projects/velocity/versions/3.1.2-SNAPSHOT/builds/150/downloads/velocity-3.1.2-SNAPSHOT-150.jar"
#VELOCITY_VERSION: "latest"
# VELOCITY_BUILD_ID: 150
DEBUG_GET: "TRUE"
ports:
- "25565:25577"
volumes:
# - ./config.yml:/config/config.yml
- ./proxy-velocity:/server
restart: unless-stopped
depends_on:
- db
- mc
networks:
- net_kipper_ml
networks:
net_kipper_ml:
external: true
volumes:
proxy-velocity: itzg commented
Your velocity config is wrong. The service hostname is just "mc".
SpookyKipper commented
but it throws this error now https://imgur.com/a/jVlEPzb
[01:36:01 ERROR]: [connected player] SpookyKipper (/myip:55210): unable to connect to server Main
io.netty.channel.ConnectTimeoutException: connection timed out: mc/142.250.72.147:25565
at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe$2.run(AbstractEpollChannel.java:613) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:170) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:394) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[velocity-3.1.2-SNAPSHOT-150.jar:3.1.2-SNAPSHOT (git-da52d093-b150)]
at java.lang.Thread.run(Thread.java:833) [?:?]
[01:36:01 INFO]: [connected player] SpookyKipper (/myip:55210) has disconnected: Unable to connect you to Main. Please try again later.
itzg commented
I didn't notice before that you were using an externally configured network. The mc service needs to be on the same network as the proxy for the Docker name resolution to work.
SpookyKipper commented
So it means i have to put mc in the same network too.
SpookyKipper commented
It works, thanks.