OpenSearch Dashboards with Podman gets the wrong unexposed IP

I have a machine X with a lot of IPs, podman-compose with OpenSearch and OpenSearch Dashboards links the images to the wrong (unexposed) IP. I tried to force the IP but if I do so, podman-compose would break. How can I do so?

I tried to add an IPv4 in the docker-compose.yml, I tried to modify the images and force the right IP whenever I found 0.0.0.0, but it keeps breaking.

Upvotes: 0

Views: 455

Answers (1)

Michael Hirt
Michael Hirt

Reputation: 111

Docker / Podman container IPs are not accessible from external clients. You need to expose TCP or UDP ports from your container to the host system and then clients will connect to :.

The host port and the container port do not need to be the same port. i.e. you can run multiple web server containers all using port 80 however you will need to pick unique ports on your host OS that are not used by other services to port-map to the containers. i.e 80->80, 81->80, 8080->80 etc.

Once you create the port definitions in your container configuration Podman will handle the port forwarding from the host to the container.

You might need to open the ports on the host firewall to allow clients to connect. 0.0.0.0 is another way of representing the local host.

Let say your host is 10.1.1.20 and your OpenSearch Dashboards container is 172.16.8.4 and your dashboard web app is configured to listen on port 5001/TCP.

You will need a ports directive in your docker-compose.yml file to map the host port 5001 to the container port 5001 similar to the below.

containers: opensearch-dashboard: ports: - "5001:5001"

As long as port 5001 is permitted on your host firewall, the client should be able to connect using https://10.1.1.20:5001/

Upvotes: 0

Related Questions