Running dash app in docker container

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 :confused:

This is my Dockerfile:

FROM python:3.6

USER root


ADD . /app

RUN pip install --trusted-host -r requirements.txt



CMD ["python", ""]

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 = ['']

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'),

        Dash: A web application framework for Python.

            '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__':

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


1 Like

I’m having the same problem :frowning: hopefully someone knows!

You need to expose port 8050 not 80 since that is the port you set when you run the app.

docker run -p 8050:8050 my_image_name


I got it working in ECS. Edit the app, include the host in the run_server command

app.run_server(host=‘’,debug=True, port=8050)


I was running into this issue as well, and the key for me was to override the default host and using “”.

Originally I just had app.run_server(), and I was unable to access the running container from the browser with the IP and port shown with docker ps (or any variation that seemed possible). As soon as I added the host param and used app.run_server(host=‘’) I was able to access the running container from the browser.

Your requirements.txt file for this?

It’s a combination of @Philippe and @tomwire solutions.

  • EXPOSE 8050
  • Specify host and port in
  • If you are actually deploying to cloud service or web, set debug=False

The location may not matter, but EXPOSE <port> is the last step in my Dockerfile.

The Docker image I use is: continuumio/miniconda3

How-to Host a Python application with Windows containers on App Service

Activating a Conda environment in your Dockerfile

Connection refused? Docker networking and how it impacts your image

YouTube: Deploy a Plotly Dash data visualization app for free on Google Cloud Run in a few simple steps.


I am having same issue.

Things that does not work for me:

if __name__ == 'main':, host='', port=8050)


if __name__ == 'main':, host='', port=8050)

Hope this will help!

I used instead of ADD, COPY /app and changed to http://localhost:8050 which worked for me