James
James

Reputation: 2143

How to access docker container listening on 0.0.0.0:8000

I am new to Docker and trying to run an open-source Django application with Docker Desktop for Windows.

Command docker container ls shows the application is running, and the service is listening on port 0.0.0.0:8000.

What IP address should I use on the Windows host to access this service? I appreciate your help.

docker container ls

...
1f2c70d56d48   saleor-platform_api          "python manage.py ru…"   23 minutes ago   Up 23 minutes   0.0.0.0:8000->8000/tcp
                                                               saleor-platform-api-1
...

Upvotes: 1

Views: 13504

Answers (2)

Tedpac
Tedpac

Reputation: 1177

As you can see here:

0.0.0.0:8000->8000

Docker is mapping the port 8000 of your container to the port 8000 of the host. Therefore, to send a request to the container, you need to make a request to localhost:8000 from the host (Windows in your case).

Upvotes: 3

dataplumber
dataplumber

Reputation: 417

You would use port 8000 and host as either localhost or 127.0.0.1 or 0.0.0.0.

Upvotes: 1

Related Questions