Has anyone been able to successfully run a Dash app in a Docker container? I’ve been able to easily run a Flask app but for some reason the same configuration with a Dash app does not work. I’m simply trying to run the Dash app in a container and access it locally but not having any luck
This is my Dockerfile:
FROM python:3.6
USER root
WORKDIR /app
ADD . /app
RUN pip install --trusted-host pypi.python.org -r requirements.txt
EXPOSE 80
ENV NAME World
CMD ["python", "app.py"]
This is the app (straight from Dash docs but am explicitly using Flask):
import dash
import dash_core_components as dcc
import dash_html_components as html
import flask
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
server = flask.Flask(__name__)
app = dash.Dash(__name__, server=server,external_stylesheets=external_stylesheets)
app.config.suppress_callback_exceptions = True
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(port=8050)
Would ultimately like to deploy this to ECS but can’t even get it running locally with docker run -p 80:80 my_image_name
Thanks