version: "3" services: php7.4: build: context: ./php7.4/ dockerfile: dockerfile volumes: - ./php7.4/sources.list:/etc/apt/sources.list - /var/www/http:/var/www/http networks: - server container_name: php7.4 ports: - 9000:9000 restart: always mysql: # 添加 mysql 服务 build: context: mysql/ dockerfile: dockerfile restart: always environment: MYSQL_ROOT_PASSWORD: root # command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci # 设置编码 # command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci #设置utf8字符集 command: --default-authentication-plugin=mysql_native_password # volumes: # - ${MYSQL_DATA_PATH}:/var/lib/mysql networks: - server ports: - 3306:3306 container_name: mysql redis: build: context: ./redis/ dockerfile: dockerfile restart: always networks: - server # volumes: # - ${REDIS_DATA_PATH}:/data ports: - 6379:6379 container_name: redis networks: server: