docker swarm(service deploy)

  • docker swarm init
$ docker swarm init
Swarm initialized: current node (t8kuig92d8vdwe4414rnzmtvb) is now a manager.
To add a worker to this swarm, run the following command:
    docker swarm join --token SWMTKN-1-3c67w3svxaothlczwxwox2dxn8fazfdwwdj6pgenq1bgydl9qb-acvi0unra8gl9c32p1gx2gp4g
 10.128.0.14:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
$
  • docker-compose.yml作成
version: "3.7"
services:
  mariadb:
    image: mariadb:10.5
    networks:
      - nginx-django
    volumes:
      - dbData:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: xxx
      MYSQL_DATABASE: test_db
      MYSQL_USER: test
      MYSQL_PASSWORD: xxx

  django_container:
    image: pinterest_gunicorn:3
    networks:
      - nginx-django
    volumes:
      - static:/home/pinterest/staticfiles
      - media:/home/pinterest/mediafiles

  nginx_container:
    image: nginx:1.19.5
    networks:
      - nginx-django
    volumes:
      - /home/user/nginx.conf:/etc/nginx/nginx.conf
      - static:/data/static
      - media:/data/media
    ports:
      - 80:80

networks:
  nginx-django:

volumes:
  static:
  media:
  dbData:
  • create stack – import .yml and deploy the stack
  • 疎通テスト

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です