docker|docker-compose 安装nginx、php、redis、mysql

version: "3"services: nginx: image: nginx:1.21.4 #restart: always container_name: nginx volumes: - "/etc/nginx/nginx.conf:/etc/nginx/nginx.conf" - "/www/website:/usr/share/nginx/html" - "/usr/local/ngix/logs:/var/log/nginx" ports: - "80:80" depends_on: - php - mysql - redis - rabbitmq networks: docker_composer_net: aliases: - nginx php: image: php:7.4-fpm ports: - "9000:9000" container_name: php volumes: - "/www/website:/usr/share/nginx/html" networks: docker_composer_net: aliases: - php mysql: image: mysql:5.7 ports: - "3306:33060" container_name: mysql volumes: - "/usr/local/mysql:/etc/mysql/conf.d" environment: - MYSQL_ROOT_PASSWORD=root networks: docker_composer_net: aliases: - mysql redis: image: redis ports: - "6379:6379" container_name: redis volumes: - "/usr/local/redis/redis.conf:/usr/local/etc/redis/redis.conf" command: #两个写入操作 只是为了解决启动后警告 可以去掉 /bin/bash -c "echo 511 > /proc/sys/net/core/somaxconn && echo never > /sys/kernel/mm/transparent_hugepage/enabled && redis-server /usr/local/etc/redis/redis.conf" networks: docker_composer_net: aliases: - redis rabbitmq: image: rabbitmq:3.8.3-management ports: - "15672:15672" - "5672:5672" container_name: rabbitmq volumes: - "./data:/var/lib/rabbitmq" environment: - RABBITMQ_DEFAULT_USER=root - RABBITMQ_DEFAULT_PASS=root networks: docker_composer_net: aliases: - rabbitmqnetworks: docker_composer_net:

【docker|docker-compose 安装nginx、php、redis、mysql】

    推荐阅读