Docker Swarm 실행하기
$ docker swarm init
portainer에서 swarm이 생겼음을 확인가능
version: "3.7"
services:
nginx:
image: nginx:1.19.5
networks:
- network
volumes:
- /home/django_course/nginx.conf:/etc/nginx/nginx.conf
- static-volume:/data/static
- media-volume:/data/media
ports:
- 80:80
django_container_gunicorn:
image: django_test_image:5
networks:
- network
volumes:
- static-volume:/home/pragmatic/staticfiles
- media-volume:/home/pragmatic/media
secrets:
- MYSQL_PASSWORD
- DJANGO_SECRET_KEY
mariadb:
image: mariadb:10.5
networks:
- network
volumes:
- maria-database:/var/lib/mysql
secrets:
- MYSQL_PASSWORD
- MYSQL_ROOT_PASSWORD
environment:
MYSQL_DATABASE: django
MYSQL_USER: django
MYSQL_PASSWORD_FILE: /run/secrets/MYSQL_PASSWORD
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/MYSQL_ROOT_PASSWORD
networks:
network:
volumes:
static-volume:
media-volume:
maria-database:
secrets:
DJANGO_SECRET_KEY:
external: true
MYSQL_PASSWORD:
external: true
MYSQL_ROOT_PASSWORD:
external: true