$ docker run -p 8080:8080 -it --name flask -v /home/docks/flask:/var/www/html ubuntu

# apt-get update
# apt-get upgrade
# apt-get install vim
# apt-get install net-tools
# apt-get install nginx # Nginx
# apt-get install uwsgi # uWSGI
# apt-get install uwsgi-plugin-python # python과 uWSGI를 연결하는 플러그인

# apt-get install python3
# apt-get install python3-pip python3-dev
# pip3 install -U pip

# pip3 install virtualenv

# cd /var/www/html
# virtualenv service
# cd service
# . bin/activate
# pip3 install flask
# pip3 install uwsgi

# cd /var/www/html/service
# vi app.py
---
from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello_world():
return 'Hello World!'

if __name__ == '__main__':
app.run()
---

# vi /etc/nginx/sites-available/default
---
server {
listen 8080; # 연결할 포트
server_name 0.0.0.0;
location / { try_files $uri @app; }
location @app {
include uwsgi_params;
uwsgi_pass unix:/tmp/uwsgi.sock;
}
}
---

# vi /etc/uwsgi/apps-available/uwsgi.ini
---
[uwsgi]
chdir=/var/www/html/service
chmod-socket=666
callable=app
module=app
socket=/tmp/uwsgi.sock
virtualenv=/var/www/html/service
---

# service nginx restart
# service uwsgi restart

# uwsgi /etc/uwsgi/apps-available/uwsgi.ini


https://ohienbee.blogspot.kr

'Docker' 카테고리의 다른 글

도커 생성한 컨테이너 이미지 삭제  (0) 2020.06.14
도커 우분투 서버 타임존 설정  (0) 2020.06.10
도커 레드마인 설치 및 설정  (0) 2018.04.08
docker, rancher 설치  (0) 2018.01.22
Posted by 앤비
,