配置文件

# docker-compose.yml文件的版本
version: "3"
# 管理的服务
services:
  redis:
    image: redis
    ports:
      # 端口映射
      - 6379:6379
    container_name: redis
    volumes:
      # 目录映射
      - "./redis/redis.conf:/usr/local/etc/redis/redis.conf"
      - "./redis/data:/data"
    restart: always
    networks:
      - my-network
    command:
      # 执行的命令
      redis-server /usr/local/etc/redis/redis.conf
  mysql:
    image: registry.cn-shanghai.aliyuncs.com/dy_docker/mysql:5.7
    restart: always
    container_name: mysql
    ports:
      - 3306:3306
    environment: 
       TZ: Asia/Shanghai
       MYSQL_ROOT_PASSWORD: 123456
    volumes:
      - "./mysql/data:/var/lib/mysql"
      - "./mysql/conf.d:/etc/mysql/conf.d"
      - "./mysql/init:/docker-entrypoint-initdb.d/"
    networks:
      - my-network
  eladmin:
    image: registry.cn-shanghai.aliyuncs.com/dy_docker/eladmin:1.1
    restart: always
    container_name: eladmin
    ports:
      - 8000:8000
    depends_on:
      - redis
      - mysql
    links:
      - mysql:mysql
      - redis:redis
    networks:
      - my-network
networks:
  my-network:
Last modification:February 13th, 2020 at 04:00 pm
如果觉得我的文章对你有用,请随意赞赏