0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

dockerでwordpressのローカル開発環境を作る

Posted at

概要

やること

Dockerを使ってローカル環境に、1分でWordPressを構築する
https://zenn.dev/mochiblock/articles/0fc6bd37320080

上記の記事を参考にした。

version: '3'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     # ドキュメントに書いてある内容に、vlumesの部分だけ追記(任意)
     volumes:
       - .:/var/www/html
     ports:
       - "8000:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
volumes:
    db_data:

公式ドキュメントの上記でなかったのは公式ドキュメントだと

volumes:
  - .:/var/www/html

がなく、これがないと.phpの反映などをローカルでできない。今回はローカルで開発したいので編集できるようにする。

コマンド

docker-compose up

上記コマンド後

ブラウザでhttp://localhost:8000

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?