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.