Skip to content
Advertisement

Docker image not running on host 8050

I am trying to teach myself how to deploy a dash application on AWS.

I have created a folder ‘DashboardImage’ on my mac that contains a Dockerfile, README.md, requirements.txt and an app folder that contains my python dash app ‘dashboard.py’.

My Dockerfile looks like this:

enter image description here

I go into the DashboardImage folder and run

docker built -t conjoint_dashboard .

It built successfully and if I run docker images I can see the details of the image.

When I try

docker run conjoint_dashboard

The terminal tells me Dash is running on http://0.0.0.0:8050/ but it is not connecting.

I can’t understand why.

Advertisement

Answer

Update it according to your port, e.g. if your application exposes port 8050 then:

docker run -p 8050:8050 conjoint_dashboard where -p = publish first one is the HOST port, and the second is the CONTAINER port.

Also you can update your dockerfile:

FROM: continuumio/minicoda3
...

EXPOSE 8050/tcp

...

The EXPOSE instruction doesn’t actually publish the port. It functions as a type of documentation between the person who builds the image and the person who runs the container, about which ports are intended to be published.

To actually publish the port when running the container, use the -p flag on docker run to publish and map one or more ports, or the -P flag to publish all exposed ports and map them to high-order ports.

By default, EXPOSE assumes TCP. You can also specify UDP:

Advertisement