docker-compose 创建数据库模板

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

pip install docker-compose

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

version: "3.3"
services:
 redis_uat:
    image: redis:4.0
    container_name: redis_uat
    command: redis-server --appendonly yes --requirepass passsword  
    ports:
     - "3200:6379"
    environment:
       - TZ="Asia/Shanghai"
    volumes:
     - $PWD/data:/data
     #- $PWD/redis.conf:/usr/local/etc/redis/redis.conf
version: '3.1'
services:
  mongo:
    container_name: mongo
    image: mongo:3.4
    restart: always
    ports:
      - 4001:27017
    volumes:
      - /data/mongo/data/4001:/data/db
    environment:
      MONGO_INITDB_ROOT_USERNAME: user
      MONGO_INITDB_ROOT_PASSWORD: password

MYSql8

version: "3.3"
services:
    uat-db:
     image: mysql:8.0
     container_name: uat-db-4303
     volumes:
       - ./db:/var/lib/mysql
       - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
     environment:
       MYSQL_ROOT_PASSWORD: passw0rd
     restart: always
     ports:
        - "4303:3306"

nexus3

version: "3.3"

services:
  nexus3:
    image: sonatype/nexus3
    volumes:
      - "./nexus-data:/nexus-data"
    ports:
      - "8081:8081"
  
#volumes:
# nexus-data: {}

发表回复

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