Docker: Failed to connect to localhost port 8080 after 8 ms: Connection refused

2.2k Views Asked by At

I pulled a python docker image using:

docker pull python:3.8

Then I started a simple http server with:

docker run -ti -p 8080:8080 900972ffeecd python -m http.server 8080

If I docker exec into the container and run curl localhost:8080 I get the response I expect, but if I run the same curl command from the host machine it fails.

Shouldn't using -p 8080:8080 be enough to expose the port?

Potentially relevant info: I'm using colima on MacOS.

1

There are 1 best solutions below

1
On

I hate to admit, but restarting my machine sent the issue away.