Docker

[Docker]WordPress用yml

docker-compose.yml

version: "3.7"
services:
 db:
  image: mysql:8.0
  container_name: mysql8
  restart: always
  environment:
    MYSQL_ROOT_PASSWORD: password # rootユーザのパスワード
    MYSQL_DATABASE: wp_local # WordPress用DB名
    MYSQL_USER: wp_user # WordPress用DB接続ユーザ名
    MYSQL_PASSWORD: wp_password # WordPress用DB接続パスワード
 WordPress:
  image: wordpress:latest
  container_name: wordpress
  restart: always
  depends_on:
     - db
  ports:
     - 10090:80
  environment:
    WORDPRESS_DB_HOST: db:3306 # DBサーバ名:ポート番号
    WORDPRESS_DB_USER: wp_user # WordPress用DB接続ユーザ名
    WORDPRESS_DB_PASSWORD: password # WordPress用データベース接続パスワード
    WORDPRESS_DB_NAME: wp_local # WordPress用データベース名
    WORDPRESS_DEBUG: 0 # デバッグモードOFF
  volumes:
     - ./html:/var/www/html
 phpmyadmin:
  image: phpmyadmin/phpmyadmin:latest
  container_name: phpmyadmin_ingrid
  restart: always
  depends_on:
     - db
  ports:
     - 10099:80

 
 

docker-compose up -d

 
PHPMyAdmin
http://localhost:10099/
 
WordPress
http://localhost:10090/