This is the second post in our Docker + WordPress series, so if you haven't read the first one yet, do so in order to catch up. Before we continue with adding WordPress to the mix, let's revisit the setup we have currently; Because we decided to use Nginx instead of Apache, we've had to build two Dockerfiles. This approach encourages the single responsibility principle, but also brings a few issues to the mix. The biggest one is a necessary maintenance of two separate images, with almost identical source code - you need to install WordPress and set proper volumes and environment variabes in both. This can quickly lead to issues that shouldn't be there in the first place. But, now that we know the rules of the game, let's consider breaking them. Here are the three possible scenarios how to use Docker images for our project: Two separate images, one running PHP-FPM and the other Nginx The same image with both PHP-FPM and Nginx inside, running in separate containers with different startup commands One single image and container, running two processes Like with most software, it comes down to personal preference of developers, and sometimes, it's worth breaking some rules for convenience
Share This