rancher-desktop: nerdctl exposing port is not working as expected
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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (5 by maintainers)
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.
Doesn’t sound like this is resolved, so going to re-open for further investigation.
I’m seeing the same issue. I can work around this by resetting kubernetes but it’s very cumbersome to do that every time I need to restart a container.
I followed the same steps to reproduce as in the comment above: https://github.com/rancher-sandbox/rancher-desktop/issues/1411#issuecomment-1025463841
nerdctl run -p 8080:80 nginxcurl localhost:8080workscurl localhost:8080givescurl: (7) Failed to connect to localhost port 8080: Connection refusedconnection refusedThis is with: Rancher Desktop 1.1.0 Kubernetes version 1.22.7 Container Runtime: containerd Mac OS 12.2 (Intel)
If I switch the container runtime to dockerd it works.
Hello, I experienced similar problem. I started nginx container with
nerdctl run -p 8080:80 nginx. It worked as expected then I press ctr-c, container stopped. When I tried to start the container again with the same command it was not working. The container started but the port was not exported / published (I checked also with netstat).This problem disappear after restart of the rancher desktop. Then again I was able to start the nginx and it was reachable, but again when I ctr-c it stopped working again. When I changed the Container Runtime to dockerd and used ‘docker’ instead of ‘nerdctl’ everything worked as expected.
My Info: I’m on Mac Apple M1 Pro Rancher desktop 1.0.0. Kubernetes 1.23, 1.22 Container Runtime: containerd