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.

nerdctl exposing port is not working as expected

See original GitHub issue

Rancher Desktop Version

1.0.0

Rancher Desktop K8s Version

1.22.4

What operating system are you using?

macOS

Operating System / Build Version

Catalina 10.15.7

What CPU architecture are you using?

x64

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

No response

Windows User Only

No response

Actual Behavior

I start a container with exposed port:

nerdctl container run -p 9151:80 nginx
docker.io/library/nginx:latest:                                                   resolved       |++++++++++++++++++++++++++++++++++++++|
index-sha256:2834dc507516af02784808c5f48b7cbe38b8ed5d0f4837f16e78d00deb7e7767:    done           |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:bb129a712c2431ecce4af8dde831e980373b26368233ef0f3b2bae9e9ec515ee: done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:c316d5a335a5cf324b0dc83b3da82d7608724769f6454f6d9a621f3ec2534a5a:   done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:b559bad762bec166fd028483dd2a03f086d363ee827d8c98b7268112c508665a:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:5eb5b503b37671af16371272f9c5313a3e82f1d0756e14506704489ad9900803:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:1ae07ab881bd848493ad54c2ba32017f94d1d8dbfd0ba41b618f17e80f834a0f:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:78091884b7bea0fa918527207924e9993bcc21bf7f1c9687da40042ceca31ac9:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:55de5851019b8f65ed6e28120c6300e35e556689d021e4b3411c7f4e90a9704b:    done           |++++++++++++++++++++++++++++++++++++++|
layer-sha256:091c283c6a66ad0edd2ab84cb10edacc00a1a7bc5277f5365c0d5c5457a75aff:    done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 29.7s                                                                    total:  54.1 M (1.8 MiB/s)
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2022/01/30 18:33:59 [notice] 1#1: using the "epoll" event method
2022/01/30 18:33:59 [notice] 1#1: nginx/1.21.6
2022/01/30 18:33:59 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
2022/01/30 18:33:59 [notice] 1#1: OS: Linux 5.10.88-0-virt
2022/01/30 18:33:59 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1024:1024
2022/01/30 18:33:59 [notice] 1#1: start worker processes
2022/01/30 18:33:59 [notice] 1#1: start worker process 32
2022/01/30 18:33:59 [notice] 1#1: start worker process 33
2022/01/30 18:33:59 [notice] 1#1: start worker process 34

In the logs i see following error message:

{"level":"debug","msg":"guest agent event: {Time:2022-01-30 18:35:31.065519103 +0000 UTC LocalPortsAdded:[{IP:127.0.0.1 Port:9151}] LocalPortsRemoved:[] Errors:[]}","time":"2022-01-30T19:35:32+01:00"}
{"level":"info","msg":"Forwarding TCP from 127.0.0.1:9151 to 0.0.0.0:9151","time":"2022-01-30T19:35:32+01:00"}

Steps to Reproduce

nerdctl container run -p 9151:80 nginx

Result

{"level":"debug","msg":"guest agent event: {Time:2022-01-30 18:35:31.065519103 +0000 UTC LocalPortsAdded:[{IP:127.0.0.1 Port:9151}] LocalPortsRemoved:[] Errors:[]}","time":"2022-01-30T19:35:32+01:00"}
{"level":"info","msg":"Forwarding TCP from 127.0.0.1:9151 to 0.0.0.0:9151","time":"2022-01-30T19:35:32+01:00"}

Expected Behavior

The nginx test site in curl / or in the browser

Additional Information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
magicmaaaaancommented, Apr 17, 2022

I’m trying Rancher Desktop for the first time and ran into this! (Although, I was running a Postgres container.) On the first run, I can successfully connect, but upon restarting the container, I can no longer connect. I can reproduce the failure described in https://github.com/rancher-sandbox/rancher-desktop/issues/1411#issuecomment-1059532691.

Rancher Desktop 1.2.1 Kubernetes disabled Container Runtime: containerd macOS 11.6.5 (Intel)

I can also confirm that it works fine with the dockerd (moby) runtime.

3reactions
janduboiscommented, Mar 4, 2022

Doesn’t sound like this is resolved, so going to re-open for further investigation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

nerdctl port not exposed - containerd - Stack Overflow
Though container port 80 is mapped, it's not exposed. I've checked whether firewall blocks but none. nerdctl run -d -p 80:80 70999c4a17c7
Read more >
Working with Containers - Rancher Desktop Docs
nerdctl is a Docker-compatible CLI for containerd. ... with cutting-edge features of containerd that are not present in Docker. ... Exposing a Port​....
Read more >
All articles on Networking - iximiuz
And it's probably for good that Docker doesn't allow you to expose ports on the fly easily. Published ports are part of the...
Read more >
Docker Expose Port: What It Means and What It Doesn't Mean
Docker has two tools for managing ports: Docker expose port and Docker ... it expected to find a web server on port 80,...
Read more >
Using Rancher Desktop for Local Kubernetes Development
You can easily configure your environment, set up port forwarding rules, change Kubernetes versions and scan images for security problems.
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