Richard Beck

Self-host a WordPress website with Docker

February 2, 2026 4 min read 0 comments
WordPress

Self-hosting with Docker is a great way to cut web hosting costs if you already have the tools and necessary hardware. During the summer of 2025, I bought a UGreen NAS and I went full on learning Docker. I had some Docker experience after installing it on my Mac Mini M4 and learning how to create compose files. After buying a NAS with Docker built-in, I spent hundreds of hours becoming an experienced Docker user.

 

What I used to setup my self-hosted WordPress install

  1. UGreen NAS (you can use something much cheaper like a Raspberry Pi, etc.)
  2. Docker
  3. NPMPlus (It’s an NGINX reverse proxy installed via Docker)
  4. Domain name

 

Here is my Docker compose file for WordPress with MariaDB database

Things to note:
  1. WordPress wants to defaul to port 80. Since NPMPlus is using port 80, I used the “ports:” line in my code and mapped the container port 8727 to port 80.
  2. Don’t forget to change the passwords below! There are 3 total that need updating.
  3. Under volumes, don’t forget to update the left-side of the colon (:) to indicate where your data is going to be stored for your WordPress and MariaDB files.

services:
  wordpress:
    image: wordpress:latest
    network_mode: host
    container_name: wordpress
    restart: unless-stopped
    ports:
      - “8727:80”
    environment:
      WORDPRESS_DB_HOST: database # Name of your database service
      WORDPRESS_DB_NAME: wordpress
      WORDPRESS_DB_USER: wp_Richard
      WORDPRESS_DB_PASSWORD: UseYourOwnPasswordHere
    volumes:
      - /volume2/docker/wordpress/data:/var/www/html

  database:
    image: mariadb:latest # Or mysql
    network_mode: host
    container_name: wordpress-database
    restart: unless-stopped
    environment:
      MARIADB_ROOT_PASSWORD: UseYourOwnPasswordHere
      MARIADB_DATABASE: wordpress
      MARIADB_USER: wp_Richard
      MARIADB_PASSWORD: UseYourOwnPasswordHere
    volumes:
      - /volume2/docker/wordpress/data:/var/lib/mysql

 

Using NPMPlus to expose WordPress to the Internet

I exposed WordPress by using:
  1. NPMPlus (reverse proxy)
  2. DNS Provider (Cloudflare is free and Cloudns is a cheap alternative to Cloudlfare)
  3. Domain name
  4. REQUIRED: Need to login to home router and forward port 80 and 443 to the IP of the device where Docker and WordPress are installed. For additional security, forward WAN port 80 to port 443 since HTTP is insecure.

Login to your DNS provider and point your domain to your home IP address. I have AT&T fiber Internet, and my home IP address never changes. If that’s not the case for you, then you will need to signup for a Dynamic DNS provider.

In my NPMPlus software that I’m running via Docker, I enter in the domain name and forward to http://192.168.1.3 – Port 8727. What you enter will most likely be different. 192.168.1.3 is the IP address of my UGreen NAS, which is where Docker and WordPress are installed.

You also need to have an SSL certificate installed. On the TLS tab of your Proxy Host within NPMPlus, you’re going to have to select your DNS Provider. In my case, it’s Cloudflare. You then need to provide your Cloudflare API key in the box below:

NPMPlus
 

Conclusion

If everything is successful, your SSL certificate should generate via NPMPlus and you should be able to access WordPress via your public domain. Keep in mind, you need to wait for DNS to propogate in order to visit your website and for your SSL certificates to install properly. If you get any errors, give it a little time and try again.

Something else to note; a lot of companies block websites that are self-hosted. I tried self-hosting WordPress, but soon realized that a number of people couldn’t visit my website on their company’s network. Companies tend to be overzealous with their firewall rules, so I’m not entirely surprised. With that being said, I ended up moving my website over to a cheap cPanel web hosting provider since this is a resume website afterall.

5 1 vote
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x