question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Port forwarding not working as expected

See original GitHub issue

Actual Behavior

Self built images don’t open ports when run with nerdctl run -p 127.0.0.1:8081:80 f2d889a1bc4c. Prebuilt nginx container opens up port 8080 as expected when run with nerdctl run -d -p 127.0.0.1:8080:80 nginx:alpine.

lima.ha.stderr.log shows no error, but also shows no success unlike for nginx image which results in: "level":"debug","msg":"guest agent event: {Time:2022-02-17 15:20:26.158725448 +0000 UTC LocalPortsAdded:[{IP:127.0.0.1 Port:8080}] LocalPortsRemoved:[] Errors:[]}","time":"2022-02-17T16:20:26+01:00"

Steps to Reproduce

Run nerdctl run -p 127.0.0.1:8081:80 f2d889a1bc4c with an image that should react on port 80. Try to telnet into port

Result

Connection not possible on chosen port

Expected Behavior

Connection pssible on exposed port

Additional Information

No response

Rancher Desktop Version

1.0.1

Rancher Desktop K8s Version

1.23.3

Which container runtime are you using?

containerd (nerdctl)

What operating system are you using?

macOS

Operating System / Build Version

macOS Monterey 12.01

What CPU architecture are you using?

arm64 (Apple Silicon)

Linux only: what package format did you use to install Rancher Desktop?

No response

Windows User Only

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
danieldonoghuecommented, Feb 24, 2022

I the same issue; I am using Mac m1, moby/dockerd and have exposed the relevant ports in my Dockerfile and published when running but if I attempt to send anything to those ports, I get connection refused…

on the host:

% docker ps|grep cont
ef25e8e3f392   dd-image                "/entrypoint.sh"         36 minutes ago   Up 36 minutes (healthy)   0.0.0.0:16384->16384/udp, :::16384->16384/udp   dd-container

on the container:

% docker exec -it dd-container /bin/bash
bash-5.1# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 02:42:AC:11:00:02
          inet addr:172.17.0.2  Bcast:172.17.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:104 errors:0 dropped:0 overruns:0 frame:0
          TX packets:110 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6578 (6.4 KiB)  TX bytes:6547 (6.3 KiB)
bash-5.1# nc -l -u -p 16384 -s 0.0.0.0 -v
listening on 0.0.0.0:16384 ...

on the host:

% cat /tmp/test|nc -u 127.0.0.1 16384
read(net): Connection refused

digging further, I see the port is configured in the DOCKER iptables chain on lima…

lima-rancher-desktop:/Users/danield$ sudo iptables -L DOCKER
Chain DOCKER (3 references)
target     prot opt source               destination
ACCEPT     udp  --  anywhere             172.17.0.2           udp dpt:16384
0reactions
gunamatacommented, Aug 24, 2022

The problem reported in the issue description seems to have been sorted out. Closing the issue. Please free to reopen if it’s still a problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Port forwarding not working as expected - Super User
I have a cheroot (cherrypy) server listening on port 1200. An lsof command confirms cheroot is listening on 1200, initialized with the right ......
Read more >
Port Forwarding Not Working? – How to Troubleshoot?
Port Forwarding Not Working? – How to Troubleshoot? · 1. Check the port forwarding configuration. · 2. Check the connectivity on the source...
Read more >
Port forwarding doesn't work, tried literally everything
Port forwarding isn't set on your pc, it's set on your router. You have to log into your router and set the port...
Read more >
Port forwarding not working as expected - Sophos Community
Adding another port forward rule and it is not working. Port 3 is my WAN, and I have checked the log, it is...
Read more >
Why does port forwarding not working in my router ... - Quora
Check your WAN (Internet) port IP address on the router. Then, visit Test your IPv6. If the IPv4 doesn't match your WAN address,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found