This is a guide on setting up WordPress on a Synology using a Docker image using the web based user interface. The DSM version this guide is based on is DSM 6.1.5-15254. Your mileage may vary with other versions.
The WordPress Docker container image does not include a database with it. You will need to setup a database prior to setting up WordPress. There are multiple methods to connect WordPress to the database you have, but the method outlined here uses the container linking capabilities of Docker. I found it to be a very simple and reliable way to connect containers when all hosted on the Synology system.
- Database running MySQL or MariaDB – see my article on setting up MariaDB on Synology using Docker.
- Docker package installed on Synology.
Step 1 – Obtain the WordPress Docker container image.
Open up Docker and go to the Registry.
Search for “wordpress” and click on the official WordPress container image and click download. The official container image has a nice little ribbon to identify it.
When it asks you to choose a tag, select “latest” and click “Select”.
Step 2 – Create the container from the image
Go to Image section in the Docker tool, highlight the WordPress Docker container image and click “Launch”. This will start the container creation wizard.
Step 3 – Configure the container settings
Give the container a name. By default it will be “wordpress1”, you can keep that or rename it to whatever you prefer. Click on “Advanced Settings” once you have the name you want.
Under Advanced Settings click on “Enable auto-restart”.
Leave the settings under the Volume tab blank.
Leave the network set to “bridge” Network tab.
Change “Local Port” from “Auto” to some other value under Port Settings. What you use depends on other services that might be running. Ultimately it doesn’t matter what you set it to as long as the port number is not already in use and the number is between 1024-65535. If you are making the WordPress site available from the Internet and it is behind your Internet router, don’t forget to setup a port forward rule to direct it to whatever port you pick.
There are multiple methods to connect WordPress to a database. The method I am going to describe uses container linking to connect WordPress to a MariaDB database I already had setup. This would work the same with MySQL. Using the link method eliminates the need for use of environment variables and makes the installation fairly simple. Look at the references section for most information on other methods if you need them.
In the “Links” tab, click the add button and select the database container from the dropdown. You need to set the alias to “mysql” regardless of the database type you used.
Once you set the link, click “Apply” to bring you back to the general settings and click “Next” to go to the final review. Review the settings to make sure you didn’t miss anything, and once ready click “Apply” to create the container.
Step 4 – Setup WordPress
At this point you should have a working installation of WordPress that you can connect to by navigating to the IP address of your Synology with the port you assigned the container. For example – http://10.0.0.10:9000. Now you will just need to finish customizing WordPress to suit your needs.