18

When trying to map a port with Docker on colima, the map works, but the port is not open for listening on MacOS

You may end here if you went through this or this other questions and still stuck.

For:

  • OSX
  • Using colima
  • on M1

A docker container exposing a port will not be listening (checked for example with netstat) even if docker port \<container\> shows it is.

Example docker run: docker run -p 80:80 -name mycontainer myimage

What is the solution so that the port is listening in the local host?

0

2 Answers 2

31

The answer is in the Colima FAQ - Enable reachable IP address

colima start --network-address

It is only a mechanism for OSX because it asks for an admin pwd to be able to work.

1
  • Thank you! Thank you! I had forgotten that I was using colima and my container ports were just getting forwarded on the localhost! Spent countless minutes before coming across this question and answer! Commented Jul 31, 2023 at 22:30
4

This problem suddenly happened to me, which was odd cause I'd been running docker containers and accessing them via localhost:port.

I tried a bunch of things but stopping and starting colima is what finally did it for me.

Not the answer you're looking for? Browse other questions tagged or ask your own question.