Dockerで環境構築する
ネットワーク
phpmyadminをリバースプロキシで表x示
プロキシサーバーはcaddy
phpmyadminの設定項目
PMA_HOST
docker-compose.yml
code:yml
version: '3.7'
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
environment:
PMA_HOST: sample.com
# ports:
# - ${PMA_PORT}:80
volumes:
- ./docker_data/phpmyadmin/sessions:/sessions
caddy:
image: caddy:latest
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./site:/srv
- caddy_data:/data
- caddy_config:/config
volumes:
caddy_data:
caddy_config:
code:Caddyfile
sample.com
reverse_proxy phpmyadmin:80
MariaDB
code:yml
version: '3.7'
services:
mariadb:
build: ./mariadb
restart: always
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
TZ: 'Asia/Tokyo'
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
volumes:
- ./docker_data/db/data:/var/lib/mysql
code:dockerfile
FROM mariadb:10.4.5-bionic
COPY ./my.cnf /etc/mysql/conf.d/
RUN chmod 644 /etc/mysql/conf.d/my.cnf
cnfファイル必要?
code:my.cnf
character-set-server=utf8
# collation-server=utf8_general_ci
lower_case_table_names=0
symbolic-links=0
skip-character-set-client-handshake
sql_mode=STRICT_TRANS_TABLES
general_log=1
log_output=FILE,TABLE
max_allowed_packet = 32M
wait_timeout = 57600
general_log # 詳細ログ有効化
general_log_file=/dev/stdout
default-character-set=utf8
default-character-set=utf8
log-error=/dev/stdout