Connect 2 containers rootless with postman-compose?
Hello,
I have two Podman containers. One container that contains Linkstack and another container for the Nginx Proxy Manager.
Now I want the Nginx Proxy Manager to retrieve the website from the Linkstack container. Unfortunately this does not work.
I integrate the two containers in a network. I realize this with podman-compose.
First, I created the network with "podman network create n_webservice".
I have tried everything possible in the Nginx Proxy Manager with the entry, but unfortunately I can't get any further.
The destinations http://linkstack:4430 and http://127.0.0.1:4430 are not working.
Can someone please help me how I can access the linkstack container from the NGINXPM container?
I had the same issues when I first started out with podman. The solution I found was to make a pod and place the containers within the pod. They'll be able to access each other through localhost:port. If you need ports published outside the pod, then they'll need to be specified during pod creation.
I didn't use podman-compose, so I can't speak specifically to how you'll go about this with a compose yaml.
It took many pages of websites for me to find something I understood. I'll see if I can find which websites I used and post them in a bit.
Took awhile, but here's how to get the previously mentioned article working at a basic level. I'll write this out for future people in case they come across this post.
If you would like to reset podman to factory default (i.e. absolutely nothing configured), then you can start with the below command. I used this a lot when testing out different things in podman to help give me a clean slate.
podman system reset --force
Create the pod and containers within the pod. Note the pod is treated like a container itself, so we publish the ports on the pod instead of the containers.
podman pod create --restart unless-stopped -p 8080:80 -p 4443:443 -h podhost testpod
podman run -dt --pod testpod --name httpd docker.io/jitesoft/lighttpd:latest
podman run -dt --pod testpod --name alpine docker.io/library/alpine:latest
Which will return the default 404 page since lighttpd is not configured.
And then running curl outside the container on localhost will present with the same default 404 page:
curl http://localhost:8080
This may not fit your exact use-case, but with the article it should get you going. If using pods, macvlan, or slirp4netns, you should be headed in the right direction.
I'll repost the sources that led me down this path here:
Here is the article I used to help me understand what I wanted to do. Hiding away in the actual Podman tutorials lol. Once I get my laptop up and running, i'll post my config since it's running in my learning environment and I haven't done anything with podman in my prod homelab; however, this let me get two containers (database and webapp) connecting together.
My environment is podman in AlmaLinux 9.4 SELinux inside a Hyper-V VM on Windows 11. I can access the webpapp in the podman pod from outside my laptop.