Reputation: 123
I want to run two containers on the same server via podman.
<server_ip>:4200
localhost:8000
The following works on my local pc but not on the server:
localhost
and publish the ports 4200 and 8000:podman pod create -p 4200:4200 -p 8000:8000 --name=mypod
podman run --pod=mypod <frontend_image_id>
podman run --pod=mypod <backend_image_id>
When doing the same on the server I the containers are not reachable from outside the server via <server_ip>:4200
or <server_ip>:8000
. From inside the server, e.g. via curl localhost:4200
the containers are reachable.
What also works is deploying containers on the server using the network option host
as follows.
podman run --network host <image_id>
In that case, the containers are reachable via <server_ip>:4200
or <server_ip>:8000
from the outside but don't reach each other via localhost
.
I must be missing something here, please help or explain this behavior.
Upvotes: 0
Views: 2023
Reputation: 21
Saw this in another thread sometime ago , but have you checked your firewall config ?
If your running a redhat dist (fedora, centos, rhel) , try add the ports to your firewall. Run this as root.
firewall-cmd --add-port=4200/tcp --permanent
firewall-cmd --add-port=8000/tcp --permanent
firewall-cmd --reload
I had the same issue when running podman as non root user and that worked for me.
Upvotes: 1