Docker + WordPress + phpMyAdmin

Docker ファイル

docker-compose.yaml


version: "3"

services:
    wordpress:
        build:
            context: .
        restart: always
        volumes:
            - ./wordpress:/var/www/html
            - ./vendor:/vendor
        ports:
            - 8080:80
        depends_on:
            - mysql

    mysql:
        image: mysql:8
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: password
            TZ: 'Asia/Tokyo'
        volumes:
            - ./mysql:/var/lib/mysql
            - ./sql:/sql

    phpmyadmin:
        image: phpmyadmin:5
        restart: always
        ports:
            - 8081:80
        environment:
            # - PMA_ARBITRARY=1
            - PMA_HOST=mysql
            - PMA_USER=root
            - PMA_PASSWORD=password

Dockerfile

FROM wordpress:latest

RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli

WORKDIR /var/www/html

COPY ./wordpress /var/www/html