0

I am not able to connect to the docker container from my host machine (Windows 10 Home).

#This is how my Dockerfile looks like

FROM ubuntu:latest
RUN apt-get update -y
RUN apt-get install -y python-pip python-dev build-essential
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["app.py"]

After running docker build -t flask-sample:latest and then docker run -d -p 5000:5000 flask-sample, it shows Running on http://0.0.0.0:5000/, but nothing on my browser shows up. Also, when I connect to the docker ip address on the port 5000 (i.e. 192.168.99.100:5000) everything works fine.

What am I missing here?

Akash Aaron
  • 116
  • 1
  • 7
  • Where does docker container run? Linux? – Michel Foucault Mar 31 '20 at 16:03
  • What URL are you accessing on browser? `http://localhost:5000` or `http://0.0.0.0:5000` – Kapil Khandelwal Mar 31 '20 at 16:53
  • 1
    Since you're on Windows Home and using Docker Toolbox, you have to use the `docker-machine ip` address; `localhost` won't work (and `0.0.0.0` doesn't make sense in a URL). – David Maze Mar 31 '20 at 17:20
  • Alright, so docker doesn't expose the container port to the host port? And there is no way for me to access the container from the host? All this because I have Windows 10 Home :P. Right? – Akash Aaron Mar 31 '20 at 17:27

0 Answers0