Run Dash application using Docker Desktop

Hi,

I couldn’t find any informations about my problem on forum and in the docker documentations, so I write here.

I would like to run my dash application using Docker Desktop. I have a Dockerfile

FROM python:3.7
RUN pip install dash==1.9.1 # The core dash backend
RUN pip install dash-renderer==1.2.4 # The dash front-end
RUN pip install dash-html-components==1.0.2 # HTML components
RUN pip install dash-core-components==1.8.1 # Supercharged components
RUN pip install pandas
RUN mkdir app
COPY app/app.py /app
EXPOSE 8050
CMD [“python”, “app/app.py”]

and very simple app.py in app folder.

import dash
import dash_core_components as dcc
import dash_html_components as html
from flask import Flask
external_stylesheets = [‘https://codepen.io/chriddyp/pen/bWLwgP.css’]
app = dash.Dash(name, external_stylesheets=external_stylesheets)
app.layout = html.Div(children=[
html.H1(children=‘Hello Dash’),
html.Div(children=‘’‘Dash: A web application framework for Python.’‘’),
dcc.Graph(
id=‘example-graph’,
figure={
‘data’: [
{‘x’: [1, 2, 3], ‘y’: [4, 1, 2], ‘type’: ‘bar’, ‘name’: ‘SF’},
{‘x’: [1, 2, 3], ‘y’: [2, 4, 5], ‘type’: ‘bar’, ‘name’: u’Montréal’},
],
‘layout’: {
‘title’: ‘Dash Data Visualization’
}})])
if name == ‘main’:
app.run_server(host=‘0.0.0.0’, port=8050, debug=True)

I create image

docker build -f Dockerfile -t stream:v1

and run

docker run -p 8050:8050 IMAGE ID

Then I get information

Running on 0.0.0.0:8050
Debugger PIN: 125-809-495
*Serving Flask app “app” (lazy loading)
*Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
*Debug mode: on
Running on 0.0.0.0:8050
Debugger PIN: 810-270-898

Nevertheless, when I want to open my application via chrome browser (0.0.0.0:8050/) it doesn’t work.
I tried using the container ip but it didn’t help.

Thank you for the advice !