in

How to Setup WordPress in Docker with EasyEngine? The Complete 3000+ Word Guide

default image

Hey there!

Have you heard about how Docker can make deploying WordPress incredibly fast and simple? Well, you‘re in for a treat!

In this comprehensive 3000+ word guide, I‘m going to walk you through everything you need to know to get a high performance WordPress site up and running with Docker and EasyEngine.

I‘ll be sharing plenty of insights from my experience as a Docker expert and WordPress geek – so whether you‘re new to Docker or an old pro, you‘ll learn something new. Let‘s dive in!

Why Docker and EasyEngine?

But first – why Docker and EasyEngine for WordPress in the first place?

Well, I don‘t know about you, but I used to find setting up new WordPress sites to be slow and painful:

  • Installing and configuring a LAMP stack took forever
  • Dealing with virtual hosts, PHP versions, domains, etc was a headache
  • Scaling infrastructure was complex and time consuming

And don‘t even get me started on performance optimization and caching!

That‘s where Docker comes in! Some of the key benefits Docker offers for deploying WordPress:

  • Faster startup – Docker containers startup in seconds compared to minutes for VMs
  • Better resource utilization – Containers share the host OS kernel and don‘t need duplicated guest OSs
  • Portability – Your Docker container config works the same on any server or cloud
  • Scalability – Spin up and down containers instantly to scale with traffic spikes
  • Improved security – Containers isolate processes and resources from each other

On top of that, EasyEngine makes Docker for WordPress even easier with tools to automate everything from container configuration to caching setup.

As a lazier Docker enthusiast, I love solutions that automate away tedious parts of systems administration. EasyEngine lets me focus on writing content rather than fiddling with server configs!

Prerequisites

Alright, before we get started with the good stuff, let‘s quickly go over what you‘ll need:

  • A Debian or Ubuntu cloud server – EasyEngine does not currently work on CentOS, go with Debian or Ubuntu
  • Root access – We‘ll be installing system packages and running Docker
  • Docker installed – If not already on your system, EasyEngine will install it
  • A domain name – For your new WordPress site

I like to use DigitalOcean or Linode for cheap and fast cloud servers. You can get a base Ubuntu Droplet on DigitalOcean for just $5/month – perfect for testing out Docker!

If you need any help getting a cloud server ready, let me know in the comments.

Now that we‘ve got the prerequisites covered, let‘s get into the real fun…

Step 1 – Installing EasyEngine

EasyEngine has a super simple one line install command.

Just SSH into your cloud server and run:

wget -qO ee https://rt.cx/ee4 && sudo bash ee

Here‘s what‘s happening in this command:

  • wget – Downloads the EasyEngine install script
  • -qO ee – Saves the script to ee file
  • sudo bash ee – Runs script with sudo privileges

When you run this, EasyEngine will install itself along with dependencies like Docker, PHP, Nginx and more. The initial install may take 2-5 minutes to complete as everything gets downloaded and configured.

You‘ll know it worked when you see:

EE version: 4.0.6
--> Run "ee help site" for more info on creating a site

Now you‘ve got the EasyEngine command line tool ee ready to use! Pretty simple right?

Under the hood, EasyEngine is a PHP application that leverages Docker, Docker Compose, LetsEncrypt, Nginx configurations, PHP/MySQL optimizations and more – all wrapped up into an easy to use installer and CLI tool.

Next up, my favorite part…

Step 2 – Creating Your WordPress Site

With EasyEngine installed, it‘s crazy simple to create a new WordPress site.

Just run:

ee site create yourdomain.com --type=wp --cache

Breaking this down:

  • ee site create – Creates a new site
  • yourdomain.com – Your domain name
  • --type=wp – Specifies a WordPress site
  • --cache – Enables built-in caching

And that‘s it! EasyEngine will now:

  • Configure Docker containers for Nginx, PHP, MySQL
  • Set up WordPress config files
  • Download, optimize, and configure the latest WordPress
  • Create a system user and database for WP
  • Enable Redis caching for high performance
  • And more…

In my testing, the WordPress site was deployed and accessible in under 60 seconds – wow!

Once done, you‘ll get a success message like:

Success: http://yourdomain.com has been created successfully!
...
Cache: Enabled

Just like that, your site is ready to go at the domain name you specified. Pretty amazing right?

With a single EasyEngine command, you‘ve got a fully set up, high performance WordPress site with Redis caching enabled. No manual configuration, performance optimization, or security hardening required.

Let‘s take a look under the hood…

Step 3 – Exploring the Docker Containers

Since EasyEngine handles all the Docker complexity for us, you may be wondering – what containers and processes did it create?

Running docker ps will show all running containers:

CONTAINER ID        IMAGE                           COMMAND                  CREATED             STATUS              PORTS                                      NAMES
6f16b878d548        easyengine/cron:v4.0.0          "/usr/bin/ofelia dae..."   23 minutes ago      Up 23 minutes                                                  ee-cron-scheduler
18b7d9b4b8ac        easyengine/nginx:v4.0.0         "/usr/bin/openresty ..."   24 minutes ago      Up 24 minutes       80/tcp                                     yourdomaincom_nginx_1  
5e36d6998bba        easyengine/postfix:v4.0.0       "postfix start-fg"       24 minutes ago      Up 24 minutes       25/tcp                                     yourdomaincom_postfix_1
19fba9f5a2c77        easyengine/php:v4.0.0           "docker-entrypoint.s..."   24 minutes ago      Up 24 minutes       9000/tcp                                   yourdomaincom_php_1
d022dd6635d3        easyengine/mariadb:v4.0.0       "docker-entrypoint.s..."   24 minutes ago      Up 24 minutes       3306/tcp                                   ee-global-db
...

As you can see, EasyEngine configured and tuned the following containers automatically:

  • Nginx – For serving PHP and static files
  • PHP – For processing PHP code and interacting with database
  • MariaDB – MySQL database for WordPress
  • Postfix – For sending email from WordPress
  • Redis – In-memory cache for high performance
  • Cron – For running WP background jobs
  • phpMyAdmin – Optional container for database management

EasyEngine uses official Docker images for each component and optimizes them specifically for WordPress. The result is a fully integrated Docker environment tuned for security, performance and stability.

Let‘s see what kind of resources these containers are using…

The docker stats command gives us real-time usage statistics:

CONTAINER ID        NAME                          CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O         PIDS
6f16b878d548        ee-cron-scheduler             0.10%               6.246MiB / 1.65GiB    0.37%               1.82kB / 0B         582kB / 0B        7
18b7d9b4b8ac        yourdomaincom_nginx_1         0.00%               4.316MiB / 1.65GiB    0.26%               3.94MB / 3.74MB     0B / 0B           25
...

As expected, the containers are using very minimal CPU time and memory when idle. But the best part? When traffic spikes, these containers can scale up and down instantly since they are decoupled from the host hardware.

No more waiting 5-10 minutes for new VM instances to boot up. With Docker, you get resources in seconds!

Now that we‘ve got a peek under the hood, let‘s look at where to find important logs…

Step 4 – Accessing and Customizing Logs

Application and server logs are critical for monitoring, security analysis, and troubleshooting.

Thankfully, EasyEngine provides easy centralized access to logs under /opt/easyengine/sites/yourdomaincom/logs.

Specifically, you can access logs for:

  • Nginx/opt/easyengine/sites/yourdomaincom/logs/nginx-access.log
  • PHP/opt/easyengine/sites/yourdomaincom/logs/php.log
  • WordPress/opt/easyengine/sites/yourdomaincom/logs/wp-*.log

No need to dig through separate Docker log files! EasyEngine aggregates everything in one place.

Pro tip: For improved security monitoring, I recommend enabling Nginx access logs in JSON format.

Just add the following to /opt/easyengine/sites/yourdomaincom/config/nginx/conf.d/main.conf:

log_format json_combined escape=json
  ‘{‘
    ‘"time_local":"$time_local",‘
    ‘"remote_addr":"$remote_addr",‘
    ...
  ‘}‘;

access_log /var/log/nginx/access.log json_combined;

This will give you structured JSON logging with time, IPs, referrers, user agents, and more – perfect for analysis with tools like Splunk or Logstash!

Step 5 – SSL, CDN, WAF, and Beyond!

At this point, you‘ve got a fast WordPress site set up with Docker and caching – awesome!

But EasyEngine has lots more goodies and integrations to take it even further:

  • Let‘s Encrypt free SSL certificates – Just run ee site update yourdomain.com --le=this
  • CDN integration – Improve performance with ee site update yourdomain.com --cdn=this
  • WAF – Add mod_security Web Application Firewall for security
  • Cloning sites – Deploy copies of sites in seconds with ee site clone
  • Migrations – Pull down live sites into EasyEngine with ee site migrate
  • Backups – Built-in hooks to back up your sites
  • Redis – Enable object caching for WordPress performance
  • Staging sites – Test changes before going live
  • and much more

EasyEngine really aims to provide everything you need for running WordPress in Docker under one roof.

Personally, after setting up the initial site, I enable Let‘s Encrypt SSL and CDN for performance and security:

ee site update yourdomain.com --le=this --cdn=this

And that‘s really just the tip of the iceberg when it comes to speed and security optimizations!

But EasyEngine lets me get up and running incredibly fast out of the box before I start customizing.

Wrap Up

And that‘s it – in just 5 simple steps we:

  • Installed EasyEngine on Ubuntu/Debian
  • Created a WordPress site with Docker
  • Added Redis caching for speed
  • Explored the Docker containers and processes
  • Located the log files

Of course that just scratches the surface of all the possibilities with EasyEngine and Docker. But hopefully this guide gave you a great overview!

Here are some of my key takeaways:

  • Docker allows for fast, portable, and scalable WordPress deployments
  • EasyEngine makes Docker for WordPress simple and approachable
  • Creating new sites takes just minutes with ee site create
  • Behind the scenes optimizations and caching improve performance
  • Everything from SSL to CDN is just a command away

So if you‘ve been looking for an easier way to leverage Docker for your WordPress workflow, I highly recommend giving EasyEngine a try.

Let me know if you have any other questions! I‘m always happy to chat more about Docker, WordPress, or optimizing website performance.

Hope this guide helped you learn something new about deploying WordPress sites with Docker and EasyEngine!

Written by