Clone this repository to use as your docker base for WordPress-enabled sites. Launch docker and create a network:
docker network create amp-wp
Update the environment variables inside secret/dev.env
to suit your needs.
Start and run the containers:
docker-compose up -d
To keep files down to a minimum and to prepare for a combined CI/CD (continuous integration and continuous delivery) practice, containers are removed when you stop the dockerized app. Simply meant, all your data and configurations will be lost and the next time you run the images, the database will be reinitialized.
To avoid this loss of data, volumes are mounted that will persist even after the containers were removed.
docker-wp
|- data
|- wordpress
\-docker-compose.yml
Access the site through http://localhost/ in your browser and you should see the WordPress setup page on initial run. Proceed with the installation procedure until you have successfully logged inside the WordPress admin panel.
To access the database, use an SQL client and enter the following info:
Hostname: 127.0.0.1
Port: 8890
Username: root
Password: root123!
If you changed the default values in the secret/dev.env
file, use those values instead.
Do not use the default SQL port (3306) - it will not work when accessing the database container. Use the assigned port in the docker-compose.yml
file. The port number can be changed as long as you know what you are doing but for the purpose of this docker base, let's keep it as it is.
For security reasons, it is advisable to use SSH tunneling to access the database server for production use.
If your site requires specific PHP directives (e.g., increased memory size), you can manage directive overrides through the provided custom.ini
file.