Docker Community Forums

Share and learn in the Docker community.

Port forward not working on a macOS installation but works on others

Ok, we have a macOS laptop (one of the latest MacBook Pro with the touchID touch bar) where port forwarding does not work. Our tests are fairly simple.

1.- We bringup a container for MariaDB and port forward 3303 to 3306 (docker run --name some-mariadb2 -p -e MYSQL_ROOT_PASSWORD=my_password -d mariadb:10.2.22-bionic)

2.- We attempt to telnet to port 3303 on localhost

On all laptop we see the container running with the proper port forward

{13:42}[2.5.0]~/Documents➭ docker ps
CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS              PORTS                    NAMES
a6c53bd9df24        mariadb:10.2.22-bionic   "docker-entrypoint.s…"   2 hours ago         Up 2 hours>3306/tcp   some-mariadb2

On the laptop where it’s working when we telnet we get:

{13:49}[2.5.0]~ ➭ telnet localhost 3303
Trying ::1...
Connected to localhost.
Escape character is '^]'.

Which is what we are expecting. However on the laptop that it’s not working we get:

$ telnet localhost 3303
Trying ::1...
Connected to localhost.
Escape character is '^]'.

And it just hangs there.

We looked at the macOS firewall (turned-off), turned off any running application that could be suspect.

I’m out of ideas on that one and maybe someone here has something we can try.


1 Like

Thanks for raising. I’m getting the same issue - I suspect there is a Docker for Mac problem here, probably with the proxy that exposes ports. This is with the stable build, Version (31259).

I’ve raised a ticket on the testcontainers-java project (which I’m a maintainer of) for visibility, setting out what I’ve tried and observed so far:

I don’t think this is a Testcontainers-specific issue at all though, and believe there is most likely a bug in Docker for Mac.

It seems that this is a known bug and a fix is in the pipeline. For now, the edge build of Docker for Mac works.

More info:

Nice. Will see if we can give it a shot.