Setting up Velocity Inside Docker Container - Can't Connect To Server
I need help with trying to setup Velocity inside a docker container. I have everything set up however when I try to join thru velocity it says "unable to connect, please try again later" right after it says "Joining world...". Velocity is on port 25566 and the other server is on port 25567 and hosted on the same machine. Both servers are in online mode (with online mode being off in server properties) and are running the latest snapshot versions of paper and velocity, I think its something to do with configuring the local IP address of the docker container, but I've tried most of the IPs with no success (see pictures)
21 Replies
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close
!close
!solved
!answered
Requested by ethanic17#0
The containers should be listening on 0.0.0.0
Rather than using the IP 0.0.0.0 in velocity for the backend, use the container ID or name
ahh okay, I'll try that when I get home. Velocity is able to recognize the Docker container ID/name without it's internal Docker IP address? Sorry I am kind of new to all of this, but if I'm understanding it correctly, each Docker container has it's own internal IP address (separate from whatever IP address the local machine uses to connect players to, which routes to the docker IP), and Velocity only listens on the internal IP connection so I can just use the container ID/name directly? thank you!
Yeah, docker DNS handles mapping IDs/Names into the right IP you need.
gotcha, will update you when I try it out, im out rn but will be back home soon
but if I'm understanding it correctly, each Docker container has it's own internal IP address (separate from whatever IP address the local machine uses to connect players to, which routes to the docker IP)In the default setup, correct So you'd have all servers listening on 0.0.0.0, you would have velocity with a port mapping for whatever port you have velocity listening on on your host. Velocity would then speak to the other servers on those internal IPs (which can be resolved by just using the container ID/Name).
ahh okay I see, this is off topic but I also had a question with port forwarding those IPs as well (which I'm planning to do after setting up Velocity correctly). So with Velocity acting as a proxy to all the other MC servers inside docker containers, I technically wouldn't need to port forward every single MC server I have under the Velocity proxy correct? Since those servers are only reachable if you connect through Velocity, I should be fine with just forwarding the port where Velocity is hosted on and players can connect?
ignore the bottom diagram* just the top one since I am hosting velocity inside of a container
You would only need to port forward from router to
192.168.10.100
And have velocity listening on the port that is forwarded (by mapping that port from 192.168.10.100 to the velocity container)
Docker handles all the stuff in the box on the right
And none of that would need port forwarding unless you want to speak to those servers directly, not via the velocity proxygotcha, so I woudln't need to mess with forwarding Docker IPs or container IPs when forwarding just velocity
The box on the right is dockers "virtual" network on the "server"
Yeah, correct
(fixing, as the server had the wrong IP)
I see, thanks! when I get home later, I'll update on trying to set up Velocity again
👍
I'll likely be asleep, but others in the server will also be happy to help you if you run into further issues.
no worries, again thank you!
so I ended up just using the static IP address of my local machine with the port # (I don't know why I didn't think of this before, kinda just flew past my head lmao) and it ended up working. just wanna make sure that thats okay tho, since im using the external IP address and not the docker IP/container ID.
Would it pose a problem for when I port forward the velocity proxy tho since all the other containers link to the static IP port(s) on the machine hosted (that hasn't been forwarded) as opposed to the internal docker container ID/IP address?
The container ID/docker ID would only be used by Velocity
The port forwarding from your router still needs to use the docker hosts IP (in my above image, 192.168.1.100)
The docker ID was only to be used for velcity when specificying the backend (e.g. in the above image, HUB/Other, instead of putting
172.16.10.6:25565
, you could use hub:25565
in your velcity config)
When you expose a port in docker, it exposes it on the hosts IPahh okay, and that's regardless of whether I use the host IP or docker container ID? so theoretically it doesn't matter if I use the host IP + port or docker ID + port?
In the diagram you provided, I would forward 192.168.1.100 and whatever port Velocity is hosted on right? Velocity would then be able to route traffic to the Docker containers without the need to port forward all of the other containers ports?
Yeah
ahh gotcha
thanks for the help!! i appreciate it lots :), i might get stuck when doing port forwarding later but for now everything works!
post closed!
The post/thread has been closed!
Requested by ethanic17#0