Single docker-compose.yml that runs WordPress + MariaDB behind Caddy with automatic HTTPS via Let’s Encrypt.
Tuned to stay around ≤512 MB RAM. Fork it and ship simple brochure/blog sites fast.
- 🔐 Auto-HTTPS (Caddy + Let’s Encrypt) — zero config beyond domain + email
- 🐳 Single compose file — no extra proxy files
- 💾 Bind mounts:
./wp(site files) and./dbdata(database) - ⚙️ Memory-trimmed MariaDB & WP caps for small droplets
docker-compose.yml— Caddy + WordPress + MariaDB.env.example— copy to.envand set secretswp/— WordPress files (commit with.gitkeep)dbdata/— MariaDB data (commit with.gitkeep)
- Copy env and set values:
cp .env.example .env
- For production, set:
DOMAIN=yourdomain.com LETSENCRYPT_EMAIL=you@yourdomain.com
- Bring it up:
docker compose up -d
- Open Site:
- Production: https://yourdomain.com (cert auto-provisioned)
- Local: https://localhost (browser may warn for local cert)
- Stop / Remove:
docker compose down # Remove all data (careful!): # docker compose down -v && rm -rf wp/* dbdata/*
- SSH as root
ssh root@YOUR_DROPLET_IP
- Install Docker Quickly
curl -fsSL https://get.docker.com | sh - Clone your fork and prep
Generate a secure password (Optionally, but recommended):
mkdir -p /opt && cd /opt git clone https://github.com/notKeion/wordpress-docker-starter.git wordpress-docker-starter cd wordpress-docker-starter cp .env.example .env # Set a real domain + email and strong DB passwords nano .env mkdir -p wp dbdata && touch wp/.gitkeep dbdata/.gitkeep
# Strong hex password (64 chars ≈ 256-bit), great for .env values openssl rand -hex 32 - Open ports and start:
# If you use UFW: ufw allow 22; ufw allow 80; ufw allow 443; ufw --force enable docker compose up -d
- Updating Later:
cd /opt/wordpress-caddy-starter git pull --ff-only docker compose pull docker compose up -d --remove-orphans
- In docker-compose.yml:
- Raise wordpress.mem_limit to 320m if WP admin/plugin installs restart PHP.
- Raise db --innodb_buffer_pool_size to 96M (or 128M) for larger datasets.
- Avoid heavy plugins; keep active plugins lean.
docker compose ps # show services
docker compose logs -f wordpress # tail WP logs
docker compose logs -f db # tail DB logs
docker compose exec wordpress bash # shell into WP containerdocker compose exec db sh -c \
'mysqldump -u"$MARIADB_USER" -p"$MARIADB_PASSWORD" "$MARIADB_DATABASE"' \
> db_backup.sqlFiles: archive wp/ (uploads, themes, plugins).