version: "3.3" services: # mysql 容器 mysql: container_name: crmeb_mysql #指定容器名 # image: daocloud.io/library/mysql:5.7.5-m15 #M1芯片可以采用这个镜像 image: mysql:5.7 #一般电脑可以用这个镜像 ports: - 3366:3306 # 环境变量 environment: TZ: Asia/Shanghai MYSQL_ROOT_PASSWORD: '123456' MYSQL_USER: 'crmeb' MYSQL_PASS: '123456' MYSQL_DATABASE: 'crmeb' privileged: true command: --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --explicit_defaults_for_timestamp=true --lower_case_table_names=1 --max_allowed_packet=128M --default-authentication-plugin=mysql_native_password --sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" working_dir: /var/lib/mysql volumes: - ./mysql/my.cnf:/etc/mysql/my.cnf - ./mysql/data:/var/lib/mysql #挂载数据目录到本地 - ./mysql/log:/var/log/mysql networks: app_net: # 固定子网ip,网段必须在子网络192.168.*.* ipv4_address: 192.168.10.1 # redis 容器 redis: container_name: crmeb_redis image: 'redis:latest' ports: - "6399:6379" command: redis-server /usr/local/etc/redis/redis.conf volumes: - ./redis/data:/data #挂载数据目录到本地 - ./redis/redis.conf:/usr/local/etc/redis/redis.conf networks: app_net: ipv4_address: 192.168.10.10 # php 容器 crmeb-pro: container_name: crmeb_pro #指定容器名 image: crmeb-pro #指定镜像名 build: context: ./php #dockerfile文件路径 dockerfile: Dockerfile #制定dockerfile文件名称 restart: always environment: TZ: Asia/Shanghai ports: - 20699:20699 tmpfs: /var/temp #上传临时文件夹 working_dir: /var/www volumes: - ../../:/var/www #程序运行目录 - ../../runtime:/var/www/temp #程序缓存目录 - ./php/php-ini-overrides.ini:/etc/php/7.4/fpm/conf.d/99-overrides.ini command: php think swoole networks: app_net: ipv4_address: 192.168.10.90 networks: #网络配置 app_net: #网络名称 driver: bridge ipam: #网络配置 config: - subnet: 192.168.0.0/16 #IP区间 gateway: 192.168.10.100