Dockerは第2課を勉強する

692 ワード

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