<p>I ran into this same issue on windows and since you mentioned windows firewall I am assuming you are also running it.</p>
<p>I noticed that you did not mention any portmapping.</p>
<p>Get the ip of your podman vm.
<code>podman machine ssh</code> and then an <code>ifconfig</code>. Then you just map your port like below to your vm ip and your requests from outside should work.</p>
<p><code>netsh interface portproxy add v4tov4 listenport=&lt;hostport&gt; listenaddress=0.0.0.0 connectport=&lt;containerPORT&gt; connectaddress=172.26.29.96</code></p>

CC BY-SA 4.0
2023-11-13T09:49:36.680Z
this is exactly what i did to fix the issue. good call
Francesco Rogo
CC BY-SA 4.0
2023-11-13T21:43:12.453Z
Hope you didn't waste too much time figuring it out. Maybe mark this as the answer so the next folks can find it faster. :-) 
Now if I can figure this out on a fedora box...
eddyizm
CC BY-SA 4.0
2024-05-20T19:42:04.053Z
I ran the command you wrote(also could be found here https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking) but it didn't work!
 should I do something after running this command? like restarting something? for DockerDesktop it isn't like that and it just works! why for podman it need this forwarding?
Parsa
CC BY-SA 4.0
2024-05-28T14:39:31.093Z
@Parsa What does your netsh show? Is your ip correct and did you disable the firewall because I believe that could block it? 

I think this works differently because of the networking, for me, I am running rootless. I am sure Docker desktop is using a different network mode, you can do that as well for podman however if you run a lot of containers its better to be in their own isolated networks.
eddyizm
CC BY-SA 4.0
2023-11-13T02:48:11.857Z
2023-11-13T02:48:11.857Z
eddyizm
<p>I have to run a container running nginx as a reverse proxy using podman.</p>
<p>Dockerfile is as follows:</p>
<pre><code>FROM nginx

COPY nginx/* /etc/nginx/
</code></pre>
<p>Where basically I have a default.conf file under conf.d which is like this:</p>
<pre><code>server {

    listen       80;
    server_name  my-server;

    client_max_body_size 200M;

    location / {
        root /usr/share/nginx/html;
    }

    location /api {
        proxy_set_header X-FORWARDED-FOR $remote_addr;
        proxy_pass http://backend:3300/api;
    }

    error_page  404              /;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

}
</code></pre>
<p>where backend is an alias for another container with a rest server running on the same network that contains the proxy.</p>
<p>I setup the network with the command:</p>
<pre><code>podman create custom-network
</code></pre>
<p>then I run the following command:</p>
<pre><code>podman run -d --name=frontend -p 80:80 --network=custom-network:alias=frontend -v ./www:/usr/share/nginx/html -v ./logs:/var/log/nginx localhost/my-www:latest 
</code></pre>
<p>At this point everything is up and running and I can open my application from the browser in the same machine, but it is unreachable from another computer on the same network.</p>
<p>I already turned off windows firewall on every network, but still nothing.</p>
<p>Is there a podman command or a configuration tweak that make nginx container reachable from outside?</p>

CC BY-SA 4.0
2023-07-08T20:06:00.760Z
Read this https://github.com/containers/podman/blob/main/rootless.md. TLDR: using port below 1024 requires root. Try using 8080, if it works, you know where the problem is, couple googles and you should be good to go. Good luck.
Kyslik
CC BY-SA 4.0
2023-07-10T06:20:44.543Z
Thank you, but if that was the case the cointainer would fail to run right? In my case the container is running fine and i can access everything from localhost. The problem rises when i try from another computer on the same network, no port exposed, no access log in nginx, nothing. It's not just listening on any network other than 127.0.0.1
Francesco Rogo
CC BY-SA 4.0
2023-12-13T20:11:37.310Z
I wrote an example of how to run socket-activated nginx proxy with podman https://github.com/eriksjolund/podman-nginx-socket-activation/tree/main/examples/example5 The example uses the systemd directive `User=`, but  that could be skipped to make the example less experimental.
Erik Sjölund
<nginx><podman>
nginx container isn't reachable from outside
Francesco Rogo
# nginx container isn't reachable from outside

(Asked by: username_0 on 2023-07-06)

I have to run a container running nginx as a reverse proxy using podman.
Dockerfile is as follows:
FROM nginx

COPY nginx/* /etc/nginx/

Where basically I have a default.conf file under conf.d which is like this:
server {

    listen       80;
    server_name  my-server;

    client_max_body_size 200M;

    location / {
        root /usr/share/nginx/html;
    }

    location /api {
        proxy_set_header X-FORWARDED-FOR $remote_addr;
        proxy_pass http://backend:3300/api;
    }

    error_page  404              /;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

}

where backend is an alias for another container with a rest server running on the same network that contains the proxy.
I setup the network with the command:
podman create custom-network

then I run the following command:
podman run -d --name=frontend -p 80:80 --network=custom-network:alias=frontend -v ./www:/usr/share/nginx/html -v ./logs:/var/log/nginx localhost/my-www:latest 

At this point everything is up and running and I can open my application from the browser in the same machine, but it is unreachable from another computer on the same network.
I already turned off windows firewall on every network, but still nothing.
Is there a podman command or a configuration tweak that make nginx container reachable from outside?

**Tags:** nginx, podman

> **Comments:**
> **username_1**: Read this https://github.com/containers/podman/blob/main/rootless.md. TLDR: using port below 1024 requires root. Try using 8080, if it works, you know where the problem is, couple googles and you should be good to go. Good luck.  
> **username_0**: Thank you, but if that was the case the cointainer would fail to run right? In my case the container is running fine and i can access everything from localhost. The problem rises when i try from another computer on the same network, no port exposed, no access log in nginx, nothing. It's not just listening on any network other than 127.0.0.1  
> **username_2**: I wrote an example of how to run socket-activated nginx proxy with podman https://github.com/eriksjolund/podman-nginx-socket-activation/tree/main/examples/example5 The example uses the systemd directive `User=`, but  that could be skipped to make the example less experimental.  

---

## 1 answers

### Answer by username_3 on 2023-11-13. Score: 2 | Accepted answer

I ran into this same issue on windows and since you mentioned windows firewall I am assuming you are also running it.

I noticed that you did not mention any portmapping.

Get the ip of your podman vm.
`podman machine ssh` and then an `ifconfig`. Then you just map your port like below to your vm ip and your requests from outside should work.

`netsh interface portproxy add v4tov4 listenport= listenaddress=0.0.0.0 connectport= connectaddress=172.26.29.96`

> **Comments:**
> **username_0**: this is exactly what i did to fix the issue. good call  
> **username_3**: Hope you didn't waste too much time figuring it out. Maybe mark this as the answer so the next folks can find it faster. :-)  Now if I can figure this out on a fedora box...  
> **username_4**: I ran the command you wrote(also could be found here https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking) but it didn't work!  should I do something after running this command? like restarting something? for DockerDesktop it isn't like that and it just works! why for podman it need this forwarding?  
> **username_3**: @username_4 What does your netsh show? Is your ip correct and did you disable the firewall because I believe that could block it?   I think this works differently because of the networking, for me, I am running rootless. I am sure Docker desktop is using a different network mode, you can do that as well for podman however if you run a lot of containers its better to be in their own isolated networks.  

---

