Ah alright. I thought because you were using WHM you were planning to run some form of hosting company.
To start developing wordpress websites locally you’d need the following:
- Docker Compose
- Wordpress container ( webserver & source code ) image
- Mysql container ( mysql server ) image
Like I explained in my previous post, docker has images and containers. Images are immutable and form the basis for your containers. For wordpress and mysql there are ‘official’ base images available that are maintained by the vendor and docker.
Using docker pull you can download these images so you can run them later.
docker pull wordpress:4.6
docker pull mysql:5.7
The wordpress image contains apache and php 5.6 by default, so you don’t have to worry about installing that manually.
Because you want to run a wordpress container and a database container in the same time, you can use docker compose. Docker compose reads a config file (docker-compose.yml) that contains instructions about what containers the run and how to run them.
To start your project, create a directory somewhere on your machine and cd into that directory using your terminal. Use nano or any other text editor, and create a file called docker-compose.yml. Add the following content:
In this compose file there are two services defined, the database service and the wordpress service. These will become your containers. To simplify things a bit each service has it’s own volume, instead of separate data volume containers.
To start your containers all you need to do is run the command:
docker-compose up -d
To check if the containers are running you use:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6537574425bf wordpress:4.6 "/entrypoint.sh apach" 8 minutes ago Up 3 seconds 0.0.0.0:8080->80/tcp wordpress_wordpress_1
62b84298eaa5 mysql:5.7 "docker-entrypoint.sh" 8 minutes ago Up 4 seconds 3306/tcp wordpress_db_1
You can open op your browser and go to http://localhost:8080 to see your wordpress website. Any changes you make to the wordpress directory on your host system are directly available in your container.
Hope this helps you getting set up.