portcontainerdnerdctl

nerdctl port not exposed


I started to used containerd instead of docker. I did what was to be installed for containerd with nerdctl. Nginx was the container I ran. 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

CONTAINER ID    IMAGE                             COMMAND                   CREATED           STATUS    PORTS                 NAMES
0416dd502f86    docker.io/library/nginx:latest    "/docker-entrypoint.…"    55 minutes ago    Up        0.0.0.0:80->80/tcp    nginx

So what could be the issue?


Solution

  • I found your question having just had the same issue! I did exactly the same as you, and indeed found the same: it does not work when you expose port 80.

    I then tried a different port:

    nerdctl run -d -p 8081:80 nginx

    ... and that did work. With no additional settings needed.

    So I had a look at what else might be listening on port 80 ...

    sudo lsof -iTCP -sTCP:LISTEN -Pnl | grep :80

    ... and (in my case) limactl was listening on port 80. I assume that would explain why nginx could not also use port 80. So it seems like you just need to use a different port (probably simpler than digging into lima settings).