docker-compose

# Use root/example as user/password credentials
version: '3.1'

services:
  mysql:
    # 镜像
    image: "mysql:8.0.17"
    restart: always
    container_name: "mysql-10010"
    command: [
      "--character-set-server=utf8mb4",
      "--collation-server=utf8mb4_unicode_ci",
      "--default-time-zone=+8:00"
    ]
    environment:
      MYSQL_ROOT_PASSWORD: 123456
      MYSQL_USER: tiger
      MYSQL_PASS: tiger
    volumes:
      - "/docker/mysql/datadir:/var/lib/mysql"
      # - "/docker/mysql/my.cnf:/etc/mysql/my.cnf"
    ports:
      - "10010:3306"
  redis:
    image: "redis:5.0.5"
    restart: always
    container_name: "redis-10086"
    command: [
      "redis-server",
      # "/usr/local/etc/redis/redis.conf",
      "--appendonly yes"
    ]
    volumes:
      - "/redis/data:/data"
      # - "/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf"
    ports:
      - "10086:6379"

你可能感兴趣的:(docker-compose)