Docker中部署Mysql5.7和DbAdmin的docker-compose.yml

1、簡述node

  本文講Docker經過docker-compose.yml部署Mysql5.7和dbAdmin的方法。mysql

2、文件sql

  一、docker-compose.yml內容以下:docker

version: '3'
services:
  mysql57:
    image: mysql:5.7
    ports:
      - 0.0.0.0:3306:3306
    environment:
      - MYSQL_ROOT_PASSWORD=password001!
    volumes:
      - /opt/mysql/data:/var/lib/mysql
    deploy:
      placement:
        constraints:
          - node.hostname==server1
      restart_policy:
        condition: on-failure

  dbAdminer:
    image: adminer
    ports:
      - 3307:8080
    deploy:
      placement:
        constraints:
          - node.hostname==server1
      restart_policy:
        condition: on-failure

  二、在宿主機上建立數據目錄,來存Mysql數據庫。數據庫

     mkdir /opt/mysql/dataspa

 

  三、執行啓動建立部署rest

    docker stack deploy -c docker-compose.yml mysql57code

  四、中止部署server

    docker stack rm mysql57blog

相關文章
相關標籤/搜索