Docker Network 란?
원래는 container끼리 분리된 환경으로 실행되기 때문에 다른 컨테이너와의 연결 할 수 없다. 하지만 이러한 여러 개의 Docker Container를 하나로 묶어주는 네트워크로 쓰일 수 있으며, Container 이름을 기반으로 서로 네트워크 안에서 주고 받을 수 있다.
즉, 같은 컨테이너 안에서는 이름으로 호출하여 서로 통신이 가능하게 만들어 준다.
Create Network
portainer.io 에서 nginx와 django 를 연결시켜주는 네트워크 생성한다.
- User > nginx port > django 순으로 연결
nginx container 설정
Gunicorn nginx 기본 설정 (nginx.conf)
work_processes auto;
events {
}
server {
listen 80;
server_name example.org;
access_log /var/log/nginx/example.log;
location / {
proxy_pass [설정한_컨테이너_이름]:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
https://gunicorn.org/#deployment
Gunicorn - Python WSGI HTTP Server for UNIX
Deployment Gunicorn is a WSGI HTTP server. It is best to use Gunicorn behind an HTTP proxy server. We strongly advise you to use nginx. Here's an example to help you get started with using nginx: server { listen 80; server_name example.org; access_log /var
gunicorn.org
filezilla 로 생성한 nginx.conf 파일 올리기
https://filezilla-project.org/
FileZilla - The free FTP solution
Overview Welcome to the homepage of FileZilla®, the free FTP solution. The FileZilla Client not only supports FTP, but also FTP over TLS (FTPS) and SFTP. It is open source software distributed free of charge under the terms of the GNU General Public Licen
filezilla-project.org
nginx 컨테이너 적용
'배포 > Docker' 카테고리의 다른 글
Docker Container 의 한계, Docker Stack의 이해 (0) | 2021.11.26 |
---|---|
Docker Volume (0) | 2021.11.26 |
[Docker] django 의 Collectstatic 명령어로 Nginx 컨테이너와 동기화 할 static 파일 취합하기 (0) | 2021.11.26 |
[Docker]배포시 static 파일 지원하지 못하는 이유 (0) | 2021.11.26 |
Docker 에 gunicorn 적용한 container 생성하기 (0) | 2021.11.25 |