assetto-corsa-web/acweb

Docker port exposure

macedot opened this issue · 5 comments

Just realized we need to expose a range of ports from Docker container when running multiple ac instances.

docker run -p 8000-10000:8000-10000

Should do. Will expose a given range, auto assign (AC server should care about it) and one must be aware to configure TCP/UDP/HTTP/Plugin ports inside exported range.

Wrong. Doing as described above port must be open already. :\

So we have to add a range of ports to the Dockerfile?

We can't use the method i've described because it assumes those ports shaw be open already.
I've seen some iptables magic to do that on-the-fly, but it may be tricky.
So far, docker doesn't allow dynamic port forwarding. 👎

Actually, if we do something like the first post, with a range as small as possible, it may work. Seems that docker has some awkward memory usage when doing that.

When I first tried it at my aws box (t2.micro, 1 core, 1 GIB ram) it crashed. But when I repeated at my personal rig, it works fine. I'll do some more testing, but maybe someone else should give it a try to (can't thrust myself about it any longer).

Confirmed: forwarding a range of "only" 100 ports, it does work at smaller aws box:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                      NAMES
effdd44f32a0        local/acweb         "/app/main"              7 seconds ago       Up 5 seconds        0.0.0.0:8000-8100->8000-8100/tcp, 0.0.0.0:9999->8080/tcp   acweb
75968fca7c69        mysql:latest        "docker-entrypoint..."   6 minutes ago       Up 6 minutes        0.0.0.0:3306->3306/tcp                                    ac-mysql
ubuntu@ip:~/acweb$

Although it allow docker image usage, one needs to pay special attention when configuring acServer ports, specially/specifically when setting up stracker ports because stracker port can only be a fixed amount of ports OR AC udp port + 42, as per stracker ini description.

Also, one should also forward some ports for UDP:

-p 8000-8100:8000-8100/udp