0

I have a problem seen the results of a Dash dashboard running on a container.

First my situation:

I have a Dockerfile like this

FROM ros:noetic
EXPOSE 8050

I run this container like this

docker build -t ros-noe-test .

xhost +local:root

docker run --rm -it \
       --name noe-test \
       -v "${MYPATH}/.ros/:/root/.ros/" \
       -v "${MYPATH}/${MYDIR}/:/root/${MYDIR}/" \
       --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
       -p 8050:8050 \
       --env="QT_X11_NO_MITSHM=1" \
       --env="DISPLAY" \
       -w "/root/${MYDIR}/"  \
       ros-noe-test \
       /bin/bash

Notice that I have exposed the port 8050 and that I run the docker image with -p 8050:8050

Then inside the container I installed all necessary libraries (pandas, plotly, dash, etc) and I run the following simple example

import plotly.graph_objects as go 
fig=go.Figure(data=go.Bar(y=[2,3,1,5]))
#fig.show()

import dash
import dash_core_components as dcc
import dash_html_components as html

app=dash.Dash()
app.layout= html.Div([
    dcc.Graph(figure=fig)
])

app.run_server(debug=True, use_reloader=False)

and I get

Dash is running on http://127.0.0.1:8050/

Warning: This is a development server. Do not use app.run_server in production
use a production WSGI server like gunicorn instead

However when I go to http://127.0.0.1:8050/ in my browser I see that "The connection to the server was reset while the page was loading"

I run out of ideas of what to do.

Edit

Just for more info: after running the container if I do docker ps I get

IMAGE: ros-nore-test
COMMAND: /ros_entrypoint.sh
STATUS: Up 5 minutes
PORTS:  0.0.0.0:8050->8050/tcp
NAMES: noe-test
halfer
  • 19,824
  • 17
  • 99
  • 186
KansaiRobot
  • 7,564
  • 11
  • 71
  • 150
  • After you run all your commands and exit the container, does `docker ps` say it's running? – tripathiakshit Aug 12 '20 at 00:59
  • I don't know what you mean by "exit the container" but I will add the output of docker ps for your consideration. As you can see the container is running – KansaiRobot Aug 12 '20 at 01:01
  • Hmm, weird. Sorry, I cannot think of anything. It is possible that your files might be corrupt and accessing them causes the server to restart. You can try looking at [Docker logs](https://docs.docker.com/engine/reference/commandline/logs/) while you attempt to open the webpage on your browser and see what the logs say. – tripathiakshit Aug 12 '20 at 01:10
  • Is there a reason why you are not using a production ready web server such as gunicorn? – emher Aug 12 '20 at 05:28
  • 3
    You need to add a parameter `app.run_server(host='0.0.0.0')`. This is the same issue (if a slightly different library setup) as [Deploying a minimal flask app in docker - server connection issues](https://stackoverflow.com/questions/30323224/deploying-a-minimal-flask-app-in-docker-server-connection-issues). – David Maze Aug 12 '20 at 10:26

0 Answers0