dockerでのLaravel環境構築を考える

まず、laradockなどのdocker-compose.ymlの中身を見てみます。

Laradock:http://laradock.io/
ucan-lab: ucan-lab docker laravel

$ git clone https://github.com/ucan-lab/docker-laravel.git

version: "3"
services:
  app:
    build:
      context: ./docker/php
      args:
        - TZ=${TZ:-Asia/Tokyo}
    ports:
      - ${APP_PORT:-18000}:8000
    volumes:
      - ${PROJECT_PATH:-./src}:/work
      - ./docker/ash:/etc/profile.d
      - ./docker/php/psysh:/root/.config/psysh
      - ./logs:/var/log/php
      - ./docker/php/php.ini:/usr/local/etc/php/php.ini
    working_dir: /work
    environment:
      - DB_CONNECTION=mysql
      - DB_HOST=db
      - DB_DATABASE=${DB_NAME:-homestead}
      - DB_USERNAME=${DB_USER:-homestead}
      - DB_PASSWORD=${DB_PASS:-secret}
      - TZ=${TZ:-Asia/Tokyo}
      - MAIL_HOST=${MAIL_HOST:-mail}
      - MAIL_PORT=${MAIL_PORT:-1025}
      - CACHE_DRIVER=redis
      - SESSION_DRIVER=redis
      - QUEUE_DRIVER=redis
      - REDIS_HOST=redis

  web:
    image: nginx:1.17-alpine
    depends_on:
      - app
    ports:
      - ${WEB_PORT:-10080}:80
    volumes:
      - ${PROJECT_PATH:-./src}:/work
      - ./logs:/var/log/nginx
      - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
    environment:
      - TZ=${TZ:-Asia/Tokyo}

  db:
    image: mysql:8.0
    volumes:
      - db-store:/var/lib/mysql
      - ./logs:/var/log/mysql
      - ./docker/mysql/my.cnf:/etc/mysql/conf.d/my.cnf
    environment:
      - MYSQL_DATABASE=${DB_NAME:-homestead}
      - MYSQL_USER=${DB_USER:-homestead}
      - MYSQL_PASSWORD=${DB_PASS:-secret}
      - MYSQL_ROOT_PASSWORD=${DB_PASS:-secret}
      - TZ=${TZ:-Asia/Tokyo}
    ports:
      - ${DB_PORT:-13306}:3306

  db-testing:
    image: mysql:8.0
    volumes:
      - ./docker/mysql/my.cnf:/etc/mysql/conf.d/my.cnf
    tmpfs:
      - /var/lib/mysql
      - /var/log/mysql
    environment:
      - MYSQL_DATABASE=${DB_NAME:-homestead}
      - MYSQL_USER=${DB_USER:-homestead}
      - MYSQL_PASSWORD=${DB_PASS:-secret}
      - MYSQL_ROOT_PASSWORD=${DB_PASS:-secret}
      - TZ=${TZ:-Asia/Tokyo}
    ports:
      - ${DB_TESTING_PORT:-13307}:3306

  node:
    image: node:12.14-alpine
    tty: true
    volumes:
      - ${PROJECT_PATH:-./src}:/work
    working_dir: /work

  redis:
    image: redis:5.0-alpine
    volumes:
      - redis-store:/data

  mail:
    image: mailhog/mailhog
    ports:
      - ${MAILHOG_PORT:-18025}:8025

volumes:
  db-store:
  redis-store:

何故かdockerだと、何故か皆apacheではなくnginxを採用しています。何故なんでしょう。

そしてLaradockの仕様を見ると、コンテナに入ってcreate projectして、ローカルにファイルを同期させて編集しているように見えますね。
VagrantやEC2での初期のapache、PHP、node、ansible等のインストール部分をまとめたimageとmysqlのimageからコンテナ起動するイメージだったので、なんか違うような。。