Example code demonstrating failure to expose Docker port to external network

The references for this example include the discussion forum and documentation for docker-compose.
As for the solution, I found that adding a specific line to the full file resolved my issue.
Another potential solution is outlined in the article “Docker Stacks and Attachable networks”, which defines attachable networks as a type of swarm overlay network.
Additionally, it’s worth noting that when using EXPOSE in docker, the port remains available for TCP connections with other containers on your docker network.

Solution 1:

The app must be configured to operate on the host ‘‘.


So when you run:

> docker run -d -p 5000:5000 simple-flask-app --name simple-flask-app
* Running on (Press CTRL+C to quit)
* Restarting with stat


curl http://localhost:5000


The attribution for this information is to be given to the source at codefresh.io, specifically their tutorial on Docker and Flask titled “Hello Whale: Getting Started with Docker Flask”.

Solution 2:

The easiest fix, in my opinion, was to execute:

docker-machine ip default

Under my Windows 7 Host, I utilized Docker 18.03.0-ce to test for an IP address that is not displayed by ipconfig, and successfully printed it.

I came across this useful advice on utilizing Docker containers as localhost on Mac and Windows from the following source: https://www.jhipster.tech/tips/020_tip_using_docker_containers_as_localhost_on_mac_and_windows.html

Solution 3:

It worked (in Linux) after I rearranged the name parameter.

docker run -d -p 5000:5000 --name simple-flask-app simple-flask-app

Frequently Asked Questions