Setting up a Raspberry Pi 3 with Docker, Portainer, WordPress, Google Domain, and No-IP DDNS
In this article, we will go through the process of setting up a Raspberry Pi 3 with Docker, Portainer, WordPress, Google Domain, and No-IP DDNS. We will cover key concepts, provide detailed instructions, and use subtitles to organize the content. By the end of this article, you will have a fully functional WordPress website hosted on a Raspberry Pi 3 using Docker and Portainer, with a custom domain name and dynamic DNS.
Setting up the Raspberry Pi 3
To get started, you will need a Raspberry Pi 3 board, a power supply, a microSD card, and a case (optional). Follow these steps to set up the Raspberry Pi 3:
- Download and install the Raspberry Pi OS on the microSD card using a tool like the Raspberry Pi Imager.
- Boot the Raspberry Pi 3 and connect it to a monitor, keyboard, and mouse.
- Configure the Raspberry Pi 3 by running
sudo raspi-configand setting a static IP address.
Installing Docker and Portainer
Once the Raspberry Pi 3 is set up, you can install Docker and Portainer. Follow these steps:
- Update the package list by running
sudo apt update. - Install Docker by running
sudo apt install docker.io. - Start and enable Docker by running
sudo systemctl start dockerandsudo systemctl enable docker. - Install Portainer by running
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer.
After running the above command, you can access Portainer by opening a web browser and navigating to http://
Installing WordPress using Portainer
Now that Docker and Portainer are installed, you can use Portainer to install WordPress. Follow these steps:
- In Portainer, click on
Endpointsand then click on the name of your Raspberry Pi 3. - Click on
Stacksand then clickAdd Stack. - Paste the following code into the
Docker Composefield:version: '3.7' services: wordpress: image: wordpress:latest restart: always environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress WORDPRESS_DB_NAME: wordpress ports: - "80:80" depends_on: - db db: image: mysql:latest restart: always environment: MYSQL_ROOT_PASSWORD: wordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress volumes: - db_data:/var/lib/mysql volumes: db_data:This code will create a WordPress container and a MySQL container, with the WordPress container connected to the MySQL container. The WordPress container will be accessible on port 80.
- Click
Deploy the stack.
After the stack is deployed, you can access WordPress by opening a web browser and navigating to http://
Installing WordPress plugins
Once WordPress is installed, you can install plugins to add functionality to your website. One useful plugin is the WP PHP My Admin plugin, which allows you to manage your WordPress database using a web-based interface. To install this plugin, follow these steps:
- In the WordPress dashboard, click on
Pluginsand then clickAdd New. - Search for
WP PHP My Adminand clickInstall Nownext to the plugin. - Once the plugin is installed, click
Activate.
After the plugin is activated, you can access it by adding /wp-admin/tools.php?page=wpphpmyadmin to the end of your WordPress URL (e.g. http://
Configuring a Google Domain and No-IP DDNS
Finally, you can configure a custom domain name for your WordPress website using a Google Domain and No-IP DDNS. Follow these steps:
- Purchase a domain name from Google Domains.
- Create a No-IP account and set up a dynamic DNS hostname (e.g.
mywebsite.no-ip.org). - In the Google Domains dashboard, click on
DNSand then clickAdd custom resource record. - Create an A record with the following settings:
Name:@Type:ATTL:1HData:your-rpi-ip
This will map the root domain (e.g.
mywebsite.com) to the IP address of your Raspberry Pi 3. - Create a CNAME record with the following settings:
Name:wwwType:CNAMETTL:1HData:ghs.googlehosted.com.
This will map the
wwwsubdomain (e.g.www.mywebsite.com) to the Google Domains name servers. - In the No-IP dashboard, click on
Dynamic DNSand then clickAdd a Host. - Create a host with the following settings:
Hostname:mywebsite.no-ip.orgIP Address:your-rpi-ip
This will map the No-IP hostname to the IP address of your Raspberry Pi 3.
- In the WordPress dashboard, click on
Settingsand then clickGeneral. - Update the
WordPress Address (URL)andSite Address (URL)fields with your custom domain name (e.g.http://mywebsite.com).
After these steps are completed, your WordPress website will be accessible using your custom domain name (e.g. mywebsite.com).
In this article, we covered the process of setting up a Raspberry Pi 3 with Docker, Portainer, WordPress, Google Domain, and No-IP DDNS. We went through the following steps:
- Setting up the Raspberry Pi 3
- Installing Docker and Portainer
- Installing WordPress using Portainer
- Installing WordPress plugins
- Configuring a Google Domain and No-IP DDNS
By following these steps, you will have a fully functional WordPress website hosted on a Raspberry Pi 3 using Docker and Portainer, with a custom domain name and dynamic DNS. This setup is ideal for learning about Docker, Portainer, and WordPress, and can also be used for small-scale production websites.