Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem connecting when running with podman; works with docker #131

Open
mlandalv opened this issue Oct 6, 2022 · 3 comments
Open

Problem connecting when running with podman; works with docker #131

mlandalv opened this issue Oct 6, 2022 · 3 comments

Comments

@mlandalv
Copy link

mlandalv commented Oct 6, 2022

Not sure if this is a bug or simply my lack of skills with podman, but the server works fine with docker, but not with podman. With podman it starts but it is not possible to connect. I have the same problem with both terraria:latest and terraria:vanilla-latest.

Docker

With docker the server starts fine and it's possible to connect.

docker run -it -p 7777:7777 --rm -v /opt/terraria-server/worlds:/root/.local/share/Terraria/Worlds -e WORLD_FILENAME=World.wld -v /opt/terraria-server/config:/config docker.io/ryshe/terraria:vanilla-latest

[...]

Terraria Server v1.4.4.4

Listening on port 7777
Type 'help' for a list of commands.

: Server started
192.168.1.117:39940 is connecting...
gpath.c:115: assertion 'filename != NULL' failed

gpath.c:115: assertion 'filename != NULL' failed

[nickname] has joined.
[nickname] has left.

Ports.

lsof -i -P -n
docker-pr 7460            root    4u  IPv4 174547      0t0  TCP *:7777 (LISTEN)
docker-pr 7467            root    4u  IPv6 174549      0t0  TCP *:7777 (LISTEN)

Podman

The exact same run command but with podman. The server starts but it's not possible to connect. Stuck at "Connecting to 192.168.1.66:7777".

podman run -it -p 7777:7777 --rm -v /opt/terraria-server/worlds:/root/.local/share/Terraria/Worlds -e WORLD_FILENAME=World.wld -v /opt/terraria-server/config:/config docker.io/ryshe/terraria:vanilla-latest

[...]

Terraria Server v1.4.4.4

Listening on port 7777
Type 'help' for a list of commands.

: Server started

Ports.

lsof -i -P -n
conmon    7314            root    5u  IPv4 173141      0t0  TCP *:7777 (LISTEN)

I'm using Netavark. I'm guessing this might have something to do with it.

podman info --format {{.Host.NetworkBackend}}
netavark

There's no firewall on the server and iptables is not enabled. I've tried with upnp=0 and upnp=1 in serversettings.txt.

Any help to get this to work with podman is highly appreciated.

@ryansheehan
Copy link
Owner

ryansheehan commented Oct 6, 2022 via email

@mlandalv
Copy link
Author

mlandalv commented Oct 7, 2022

It's not a port conflict. I've also tried other ports with the same result.

I managed to get it to work when running with --network=host so it seems it isn't enough to expose port 7777, at least not for podman.

It probably has something to do with TerrariaServer.exe (and/or podman's netavark) and how it handles incoming connections. Requiring some other port range. I thought maybe enabling/disabling upnp would help, but unfortunately not.

Maybe there isn't much to be done. Feel free to close the issue if you like.

@GrayEye
Copy link

GrayEye commented Nov 23, 2022

This comes down to a fundamental difference in how Podman handles networking vs Docker. Docker makes networking easy by natively using the host network when you spin up a container. For something like this, you can get the same functionality as Docker by doing what you have done and specifying --network=host. Those interested can read more about Podman networking here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants