1、docker-compose 搭建Apache-php
新建docker-compose.yml文件
version: "3.8" networks: net: driver: bridge ipam: config: - subnet: 192.158.0.0/16 services: fpm: image: php:7.2.0-fpm-alpine3.6 container_name: php-fpm volumes: - /root/php/:/php/ networks: net: ipv4_address: 192.158.0.3 apache: image: httpd:2.4-alpine container_name: php-apache ports: - 80:80 volumes: - /root/php/:/usr/local/apache2/htdocs/ - /root/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf networks: net: ipv4_address: 192.158.0.4
2、开启容器
docker-compose up -d