docker-compose 创建数据库

作者: root007 分类: 未分类 发布时间: 2019-09-18 17:47

docker-compose -f docker-compose.yml up -d

version: "3.3"
 services:
   apollo-db-dev:
     image: mysql:5.7
     container_name: apollo-db-dev
     volumes:
       - ./db_dev:/var/lib/mysql
     environment:
       MYSQL_ROOT_PASSWORD: 123456
     restart: always
     ports:
        - "13306:3306"
   apollo-db-sit:
     image: mysql:5.7
     container_name: apollo-db-sit
     volumes:
       - ./db_sit:/var/lib/mysql
     environment:
       MYSQL_ROOT_PASSWORD: 123456
     restart: always
     ports:
        - "13307:3306"
   apollo-db-uat:
     image: mysql:5.7
     container_name: apollo-db-uat
     volumes:
       - ./db_uat:/var/lib/mysql
     environment:
       MYSQL_ROOT_PASSWORD: 123456
     restart: always
     ports:
        - "13308:3306"

https://docs.docker.com/samples/library/postgres/

version: "3.1"
services:
  pg_sonardb_1:
    image: postgres:12
    restart: always
    ports:
      - 15432:5432
    environment:
      POSTGRES_PASSWORD: sonar
      POSTGRES_USER: sonar
      POSTGRES_DB: sonar
    volumes:
      - ./pg_data:/var/lib/postgresql/data

发表评论

电子邮件地址不会被公开。 必填项已用*标注