I have a problem during using docker with dash . First:docker installation sample app works very well with me as documentation said.here
Second : what I want is to use docker for a dash-plotly application and then deploy it on aws-beanstack so I followed these steps on this link a link!
Note that I am beginner at docker so pardon for any beginner mistakes .also I have tried many solutions and I dont know where is the problem This is my application.py :
from flask import Flask
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
server = Flask('main', static_url_path='')
app = dash.Dash(name='main', sharing=True, server=server, url_base_pathname='/main/')
app.layout = html.Div([
dcc.RadioItems(
id='ri-1',
options=[
{'label': 'A', 'value': 'a'},
{'label': 'B', 'value': 'b'},
{'label': 'C', 'value': 'c'}
]
),
html.P(),
html.Div([], className='row', id='ri-val')
])
@server.route('/')
def index():
return 'another Flask app'
@app.callback(
Output('ri-val', 'children'),
[Input('ri-1', 'value')]
)
def ri_cb(ri):
print ri
return str(ri)
if __name__ == '__main__':
server.run(port=8050, host='0.0.0.0', debug=True)
And this is Dockerfile :
FROM amazon/aws-eb-python:3.4.2-onbuild-3.5.1
And this is requirements.txt :
Click==7.0
dash==0.21.1
dash-core-components==0.22.1
dash-html-components==0.10.1
dash-renderer==0.12.1
Flask==0.12.2
Flask-Compress==1.4.0
itsdangerous==1.1.0
Jinja2==2.10.1
MarkupSafe==1.1.1
plotly==4.1.1
retrying==1.3.3
six==1.12.0
Werkzeug==0.15.6
Then I use this to run :
amr@amrlinux:~/dash-example$ sudo docker run -it --rm -p 3000:8050 dash-example
the result is this :
*** Starting uWSGI 2.0.8 (64bit) on [Fri Sep 13 14:01:49 2019] ***
compiled with version: 4.9.1 on 04 November 2014 00:03:50
os: Linux-4.18.0-25-generic #26-Ubuntu SMP Mon Jun 24 09:32:08 UTC 2019
nodename: 000000000
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /var/app
detected binary path: /var/app/bin/uwsgi
setgid() to 1000
setuid() to 1000
and when I try to navigate http://localhost:3000
it shows that the page is not working
Note that when I run the file application.py
on the local host :8080 it runs successfully on local host , it doesn’t work with docker . I don’t know where is the problem .
system information : Linux ubuntu 18.1