redis mysql nginx的docker-compose

redis mysql nginx的docker-compose

version: '3'

services:
  nginx:
    image: docker.m.daocloud.io/nginx:latest
    container_name: nginx
    restart: unless-stopped
    environment:
      TZ: Asia/Shanghai
      LANG: en_US.UTF-8
    volumes: # 目录映射(宿主机:容器内)
      - "./nginx/conf/nginx.conf:/etc/nginx/nginx.conf"
      - "./nginx/log:/var/log/nginx"
      - "./nginx/html:/usr/share/nginx/html"
    ports:
      - "80:80"
      - "443:443"
    networks:
      my-network:
        ipv4_address: 172.16.0.100
    depends_on:
      - redis
      - mysql


  redis:
    container_name: redis
    restart: unless-stopped
    image: docker.m.daocloud.io/redis 
    ports:
      - "6379:6379"
    command: redis-server /etc/redis/redis.conf
    volumes:
      - "./redis/data:/data"
      - "./redis/conf/redis.conf:/etc/redis/redis.conf"
    networks:
      my-network:
        ipv4_address: 172.16.0.101


  mysql:
    image: docker.m.daocloud.io/mysql:8.0
    container_name: mysql
    environment:
      - MYSQL_ROOT_PASSWORD=root@321
    restart: unless-stopped
    ports:
      - "3306:3306"
    volumes:
      - "./mysql/data:/var/lib/mysql"
    networks:
      my-network:
        ipv4_address: 172.16.0.102


networks:
  my-network:
    ipam:
      driver: default
      config:
        - subnet: 172.16.0.0/24
          gateway: 172.16.0.1
上一篇:jQuery EasyUI 扩展


下一篇:TryHackMe 第6天 | Web Fundamentals (一)