How To Install WordPress in Docker using Docker Compose

I follow  How to install WordPress in Docker Tutorial and found it has error in its docker-compose.yml file. Besides, it didn’t tell how to access phpMyAdmin and WordPress.

I am completely newbie on Docker so it took me time to really understand.

For that reason, I copy the tutorial and improve and simplify it. So it is easier for newcomer to Docker.

How To Install WordPress in Docker Using Docker Compose?

Create a folder for your project

Create a docker-compose.yml file inside your folder

 

Run The Docker WordPress Installation

Run Docker Compose Command Same Location as Your docker-compose.yml

docker - wordpress run compose up
docker – wordpress run compose up

Access WordPress

Run the usual WordPress Installation

wordpress installation page
wordpress installation page

Database Configuration:

Database name: wordpress
Username: wordpress
Password: wordpress

Testing Your WordPress Installation in Docker

Login using username and passoword, you have created. Then insert a post.

docker creating a post in wordpress
docker creating a post in wordpress

Check at phpMyAdmin

Server: <leave it empty>
Username: WordPress
Password: WordPress

docker phpmyadmin username and password wordpress
docker phpmyadmin username and password wordpress

Check Inserted Data

docker - new post successfully inserted in database
docker – new post successfully inserted in database

Last Note

With this docker-compose configuration you can’t access to your local file system. So this another thing I need to find the solution.

 

Macbook M1 MacOS Big Sur Error MySQL PhpMyAdmin When Login

I login to MySQL using phpMyAdmin with root account and it produced this error.

Login root via terminal

I was able to login using my root password means something configuration is not correct.

macbook M1 mysql login via terminal
macbook M1 mysql login via terminal

When I googled, I found 2 solutions. I tried the first one but fail. So I documented the one that works with Macbook M1 MacOS Big Sur.

Update root Password via Terminal

Login Again At Your phpMyAdmin

It should work by now using root and the updated password.