TuRz4m / Ark-docker

Docker for ARK: Survival Evolved
167 stars 184 forks source link

docker host problems with multiple ip addresses #2

Open BigGold1310 opened 8 years ago

BigGold1310 commented 8 years ago

Hello turzam

I got an Issue with you ARK Server Image. If I had a docker host with multiple IPv4 Addresses and a single network adapter in the server which is configured like this: TYPE="Ethernet" BOOTPROTO="none" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" NAME="eth0" ONBOOT="yes" HWADDR="08:00:27:3F:AB:68" IPADDR0="192.168.1.150" IPADDR1="192.168.1.151" IPADDR2="192.168.1.152" PREFIX0="24" GATEWAY0="192.168.1.1" DNS1="192.168.1.1"

Now if I start the ark server like this: docker run –it –p 192.168.1.1517778:7778 –p 192.168.1.1517778:7778/udp –p 192.168.1.15127015:27015 –p 192.168.1.151:27015:27015/udp –p 192.168.1.15132330:32330 –e SESSIONNAME=”my ark server” –e ADMINPASSWORD=”my secret password” –e AUTOUPDATE=60 –e WARNMINUTE=30 –e SERVERPASSWORD=”my super password” –v /my/stoage/dir:/ark –e /my/backup/dir:/ark/backup –name ark turzam/ark The ark server runs nice. If I use docker exec ark arkmanager status the arkmanager tells me that everything is right but it tells me that the IP is 192.168.1.152. OK.

Now I tried to connect to the IP that I had set before and to connect to the IP wich the arkmanager said. Now steam can find the ark server but if you would like to connect you got a querry error from ark

I hope you can fix this issue.

Thank you very much for looking at our issue.

Reguards BigGold1310

TuRz4m commented 8 years ago

Hi ! I'm assuming that your IP 192.168.1.152 is on a private network behind a router. Did you forward the ports 27015 and 7778 on your router to 192.168.1.152 ?

By the way, AUTOUPDATE is no longer used in the latest version of the image. It's replaced by a crontab file (see the README).

BigGold1310 commented 8 years ago

Hi The configuration above is a example. I replaced my real IPs with this one. I had 5 IP addresses wich are routable from 2 different Networks.

TuRz4m commented 8 years ago

Ok ! If you try docker inspect ark, do you have the correct IP in HostConfig -> PortBindings -> * -> HostIp? And if you try sudo iptables -t nat -L -n, do you see the port mapped to your correct IP as destination ? (There are missing ':' in your commandline but I suppose it's a bad modification ?)

BigGold1310 commented 8 years ago

Yes. I had a IP range from 197 to 200. At start I assigned the IP 198 to the docker container.

Here my output from docker inspect ark:

"PortBindings": {
            "27015/tcp": [
                {
                    "HostIp": "xxx.xxx.xxx.198",
                    "HostPort": "27015"
                }
            ],
            "27015/udp": [
                {
                    "HostIp": "xxx.xxx.xxx.198",
                    "HostPort": "27015"
                }
            ],
            "32330/tcp": [
                {
                    "HostIp": "xxx.xxx.xxx.198",
                    "HostPort": "32330"
                }
            ],
            "7778/tcp": [
                {
                    "HostIp": "xxx.xxx.xxx.198",
                    "HostPort": "7778"
                }
            ],
            "7778/udp": [
                {
                    "HostIp": "xxx.xxx.xxx.198",
                    "HostPort": "7778"
                }
            ]
        }

And here is the output from iptables -t nat -L -n:

Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         
DOCKER     all  --  0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type LOCAL

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
DOCKER     all  --  0.0.0.0/0           !127.0.0.0/8          ADDRTYPE match dst-type LOCAL

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
MASQUERADE  all  --  172.17.0.0/16        0.0.0.0/0           
MASQUERADE  tcp  --  172.17.0.1           172.17.0.1           tcp dpt:32330
MASQUERADE  tcp  --  172.17.0.1           172.17.0.1           tcp dpt:27015
MASQUERADE  udp  --  172.17.0.1           172.17.0.1           udp dpt:27015
MASQUERADE  tcp  --  172.17.0.1           172.17.0.1           tcp dpt:7778
MASQUERADE  udp  --  172.17.0.1           172.17.0.1           udp dpt:7778
MASQUERADE  tcp  --  172.17.0.2           172.17.0.2           tcp dpt:80

Chain DOCKER (2 references)
target     prot opt source               destination         
DNAT       tcp  --  0.0.0.0/0            xxx.xxx.xxx.198        tcp dpt:32330 to:172.17.0.1:32330
DNAT       tcp  --  0.0.0.0/0            xxx.xxx.xxx.198        tcp dpt:27015 to:172.17.0.1:27015
DNAT       udp  --  0.0.0.0/0            xxx.xxx.xxx.198        udp dpt:27015 to:172.17.0.1:27015
DNAT       tcp  --  0.0.0.0/0            xxx.xxx.xxx.198        tcp dpt:7778 to:172.17.0.1:7778
DNAT       udp  --  0.0.0.0/0            xxx.xxx.xxx.198        udp dpt:7778 to:172.17.0.1:7778
DNAT       tcp  --  0.0.0.0/0            xxx.xxx.xxx.200        tcp dpt:80 to:172.17.0.2:80

A additional information. If I execute docker exec ark arkmanager status:

 Server running:   Yes 
 Server listening:   Yes 
Server Name: myserver - (v230.3)
Players: 0 / 70
 Server online:   Yes 
 ARKServers link:   http://arkservers.net/server/xxx.xxx.xxx.197:27015 
 Server version:   917005

(Thats a typing fail because i didn't copy paste it.)

TuRz4m commented 8 years ago

Ok ! Seems right. I think I found the setting you were looking for : add ark_MultiHome=xxx.xxx.xxx.198 in your arkmanager.cfg

BigGold1310 commented 8 years ago

Hi Half an hour ago I added the line at the end of my arkmanager.cfg and restartet the server. Now if I check the status of my server with docker exec ark arkmanager status I got following result:

 Server running:   Yes 
 Server listening:   No 
 Server version:   919250 
TuRz4m commented 8 years ago

At least, now it tries to run the server on the correct IP ^^. In /path/ark/log/arkserver.log, does the server is correctly run with the param ?MultiHome=xxx ? Can you try again after exec docker exec ark arkmanager upgrade ?

I'm sorry, I can't reproduce this issues as I don't have another IP on my server :/

BigGold1310 commented 8 years ago

The following command docker exec ark arkmanager upgrade doesn't exists:

docker exec ark arkmanager upgrade
arkmanager v1.4: unknown command 'upgrade' specified
Try 'arkmanager -h' or 'arkmanager --help' for more information.

Here are the logs from the arkserver.log from the latest start of the ark server:

13:51:42: start
13:51:42: Running /ark/server/ShooterGame/Binaries/Linux/ShooterGameServer TheIsland\?MaxPlayers=70\?MultiHome=xxx.xxx.xxx.198\?Port=7777\?QueryPort=27015\?RCONEnabled=True\?RCONPort=32330\?ServerAdminPassword=MyPassword\?ServerPassword=MyPassword\?SessionName=MyServer\?listen -log
13:51:42: Server PID: 16589
[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
/usr/local/bin/arkmanager: line 516:  1831 Killed                  "$arkserverroot/$arkserverexec" "$arkserveropts" "${arkextraopts[@]}"
13:51:43: Bad PID '16589'; expected '1831'
13:51:43: exited with status 0
[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.

If I run the command again, nothing had changed:

 Server running:   Yes 
 Server listening:   No 
 Server version:   919250 
TuRz4m commented 8 years ago

Sorry it's docker exec ark arkmanager upgrade-tools now.

BigGold1310 commented 8 years ago

Ok. Nothing changed. At the time i cleaned up my server it had used more than 50GB diskspace which was the maximum. Any other ideas else?

TotalLag commented 8 years ago

I ran into this too @BigGold1310, but it was mainly because I had stale docker images. Do a docker images and see how many layers of images you have?

In my case, I had a lot of <none> so I just purged by removing with docker rmi <id>

Running du -hd1 / will also show you which folder is taking up the most space. My Ark folder with the most recent update and backups is only 26GB.

Regarding your issue with different IPs for the query server, this sounds more like it could be arkmanager than this image. I think arkmanager is grabbing the first public IP it sees and uses that to advertise. Try running the container with --net=host option in addition so that your interfaces are directly available to the container instead of bridging/NATing.

I too don't have multiple IPs to test, so sorry :(

TuRz4m commented 8 years ago

Yep, I think @TotalLag is right: you can use the docker run with the flag --net=host but don't forget the multihome flag in your config file. You can read the documentation on docker networking here.

If you want to clean up docker disk space, you can use docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes --verbose. It will remove all orphaned docker volumes. (documentation here)

BigGold1310 commented 8 years ago

Ok. I will test it tomorrow or friday and give a feedback. Thx for the help guys.

BigGold1310 commented 8 years ago

Ok. I had tested the --net=host option with the -p IP:PORT:PORT option. And tested with and without arkmanager.cfg multihome flag. Nothing changed. Got the same issue again. Now any ideas left?

If I add ark_MultiHome="198" to the arkmanager.cfg the ark server is not reachable with the ark status:

docker exec f9f702c06690 arkmanager status
 Server running:   Yes 
 Server listening:   No 
 Server version:   923197 
TuRz4m commented 8 years ago

Sorry, I don't know why but I did not see your last answer. Did you manage to get it working ?

BigGold1310 commented 8 years ago

Hi

At the time I got one server up and running.

But i got the same problem if I try to start a second server.

The solution for server one was to start it on the ip wich was shown from docker exec <ark container> arkmanager status

But that dose not solve the problem.