Answers: <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>
  
Answers: CC BY-SA 4.0
Answers: 2023-11-13T09:49:36.680Z
Answers: this is exactly what i did to fix the issue. good call
Answers: Francesco Rogo
Answers: CC BY-SA 4.0
Answers: 2023-11-13T21:43:12.453Z
Answers: 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...
Answers: eddyizm
Answers: CC BY-SA 4.0
Answers: 2024-05-20T19:42:04.053Z
Answers: 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?
Answers: Parsa
Answers: CC BY-SA 4.0
Answers: 2024-05-28T14:39:31.093Z
Answers: @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.
Answers: eddyizm
Answers: CC BY-SA 4.0
Answers: 2023-11-13T02:48:11.857Z
Answers: 2023-11-13T02:48:11.857Z
Answers: eddyizm
Body: <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>
  
Comments: CC BY-SA 4.0
Comments: 2023-07-08T20:06:00.760Z
Comments: 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.
Comments: Kyslik
Comments: CC BY-SA 4.0
Comments: 2023-07-10T06:20:44.543Z
Comments: 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
Comments: Francesco Rogo
Comments: CC BY-SA 4.0
Comments: 2023-12-13T20:11:37.310Z
Comments: 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.
Comments: Erik Sjölund
Tags: <nginx><podman>
Title: nginx container isn't reachable from outside
UserDisplayName: Francesco Rogo
ThreadText: # 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=<hostport> listenaddress=0.0.0.0 connectport=<containerPORT> 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.  
  
  ---
  
  