I have setup a simple flask application in a docker container. My docker file is as follows:
FROM python ADD . /app WORKDIR /app RUN pip install -r requirements.txt CMD ["python", "myFlask.py"]
I start the container using
docker run -d myContainer
I retrieve the internal IP address by
docker exec -ti <containerID> cat /etc/hosts
and it's 172.17.0.2. When I try to ping this address or try to access the REST API using curl I cannot reach it. When I use port forwarding using
-p 5000:5000 as part of the run command I can reach the REST API under localhost:5000. I am working under OS X.
Why can't I reach the container under its local IP?