Docker engine expos port issue

I run a docker container (for example redis or nginx) with this command:

docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest

but I can’t connect to them from the local host.

when checking the port with telnet the connection was OK but when try working with them nothing is work (for example using redis-cli for the redis container or curl for nginx)

my OS is POP-OS (ubuntu) and I install docker-ce, docker-cli, docker-ce-rootless-extras

I checked that scenario with the same image on the docker desktop everything worked correctly. but I want to do that with the docker engine, not in the docker desktop.

Please share the output of docker version and docker info.

We have seen in the past that cutting edge Ubuntu versions had fundamental changes to iptables/nftables which didn’t play well with docker in the beginning.

If the POP-OS version you use is based on Ubuntu 20.04 or 22.04 it should work.

Of course, it does work with Docker Desktop, as the Docker Engine runs in a utility vm, where the kernel and os are fitted to match the needs of the Docker Engine.

What does that mean exactly? Is the curl command just hanging? Did you get timeout error or “connection refused” or anything else?