Hi! I’ ve a small unity c/s application developed using MLAPI. I’m on Windows 10 pro and i can succesfully obtain a windows build or a linux build, in default or headless mode. I want to put on a container the headless server (already tested and in a ubuntu vm). I have copied using the dockerfile the folder obtained from unity build, and i managed to run the server using cmd in dockerfile. The problem: clients on windows can’t connect to server (on docker container). The network manager uses 127.0.0.1 (localhost) as server address and i think that’s could be the problem. I tried also to use 192.168.99.100, while windows clients still set to try to connect to 127.0.0.1 without results. Someone help me please.
You will have to change the IP of the NetworkManager of your windows clients to the IP of the docker container. Which IP you use on the server is not relevant as this is only the connection address used by the clients.
In addition you might need to open udp ports of your container. So when starting the docker container you might need to add -p 7777:7777/udp (might need to change to the port of your transport)
Thanks this solved the problem !
I am encountering a similar problem, hoping someone can help me.
My machine is running Windows 11, with Unity at version 2021.2.12f1.
I have built a Dedicated Server set to Linux. In this build, the NetworkManager uses UnityTransport found in the Netcode for GameObjects package. In the UnityTransport, I have set the server to use
Address = 127.0.0.1
Port = 9041
Server Listen Address = 127.0.0.1
My client settings are as follows:
Address = 127.0.0.1
Port = 9041
Server Listen Address = 127.0.0.1
When I run this on Windows Subsystem for Linux (WSL) terminal, the client version of my game can connect to the server. However, when I package the server into a docker image and run it as a container in docker, the client is unable to connect to the docker container. The docker network settings are as follows:
0.0.0.0 : 9041 / 9041 tcp
0.0.0.0 : 9041 / 9041 udp
Since 0.0.0.0 mean any address, this should work right? I tested it with the standard nginx just to check if using 0.0.0.0 works, it does work when I tried to reach 127.0.0.1 : 80 on my browser.
I intend to run the containerized server on a commercial cloud service, and would be good if I do not have to hard-code the ip address into the server.
Appreciate any advice, thanks!