Home > OS >  "Site cant be reached" error. When running Docker container
"Site cant be reached" error. When running Docker container

Time:02-28

I am facing an error when running docker container on port 5000 on localhost. I deployed a fastapi Machine learning model and want to run it using docker container. Error:

This site can’t be reached
The web page at http://0.0.0.0:5000/ might be temporarily down or it may have moved permanently to a new web address.
ERR_ADDRESS_INVALID

Dockerfile:

FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
EXPOSE 5000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000"]

Command I am running for docker to build container:

docker build -t tags:latest .

Command to run docker container I am using:

docker run -p 5000:5000 tags:latest

CodePudding user response:

In case you are getting the error message from a client (e.g. your browser on the same machine):

When you open a server socket for IP 0.0.0.0 it means it opens that server socket on all interfaces. When you connect with a client to a server, you need to give a concise address, such as 127.0.0.1 or one of the configured IPs for that machine. Connecting to 0.0.0.0 should always result in an error message.

  • Related