This article is the continuation of WordPress with Docker, AWS (ECS, Code Pipeline, Load Balancer, RDS, EFS) Complete Series. For better understating, please start from the beginning of the series.
In this article, we will create the following files and folders
Let’s create files and folders
Dockerfile
Paste the following content into the Dockerfile
entrypoint-child.sh
Our WordPress Docker image (wordpress:latest) already contains an entry point. which is called docker-entrypoint.sh. The reason have added our custom entrypoint file into the mix is because of AWS EFS volumes for our Plugins storage on AWS. That is why we need some permissions to be added again. This entrypoint just add those permissions and then execute the image default entrypoint. Don’t worry about this for now, I will shed more light on it as we progress.
uploads.ini config
Paste the following content into config/uploads.ini file
Please change the above as per your wordpress website requirements
docker-compose
Paste the following content into development/docker-compose.yml file
We have created two service in the docker-compose file
- wordpress
- db
WordPress service is building a Docker image from the Dockerfile we have created in the begining
The above line is telling the docker-compose to build the image from a Dockerfile which is on the root of this project
The above command is just mapping the 8000 port from outside world to the port 80 of this container
We are also setting some environment variables such as database credentials which are initialized in the db service
Time to see something on the browser !!!
All the required files and directories have been created. Let’s start our wordpress website by running the following commands
Open your web browser and type http://localhost:8000 and you should be able to see this page.
Hi Salman,
I am following all the above process, but WordPress is not Launching using Docker.
Hi Salman thanks for the post – do I need to sepcify a volume in the yaml? Doesnt the COPY at startup remove the need for volumes?
This guide really helped me thank you so much.
I had issue with wp-content permission (root:root) and this article solved my problem.
Thank you.
I am glad is resolved your problem 🙂
This is great series man! Thank you for your efforts !
A question though, you define two containers one for the app and one for db. Why do you define the db container, arent’t we looking for using the RDS(mysql) db created later in these series ?