Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Docker Tip #68: It's OK Not to Use Docker for Everything

blog/cards/docker-tips-and-tricks.jpg

Docker makes it easy to run applications in a unified way, but when it comes to static sites, I typically don't run them in Docker.

One of the main benefits of using Docker is that your development environment is the same as production or any other environment but in the case of static sites, that’s not often the case (with or without Docker).

In development you might use Jekyll or Hugo to work on and build your static site, but in production you’re using nginx to serve the site. These are entirely different set ups.

What about Development?

It might be a good idea to use Docker for your static site in development, but that really comes down to what you’re willing to sacrifice.

Installing Ruby to set up Jekyll kind of stinks so having that Dockerized is a nice win.

But on the other hand, on Windows, the live reload feature of Jekyll and other static site generators don’t work inside of Docker and for me, that’s a deal breaker.

What about Production?

In production, if all my server is doing is running 1 or more static sites I do not use Docker.

Serving a static site typically involves 2 things. The first is running a web server such as nginx, and secondly, you’ll likely want to set up Let’s Encrypt.

I don’t find it to be too much of a hassle to just install these directly on the host.

If you did use Docker, that just complicates things quite a bit. Now suddenly you need to either build or pull an image and restart the nginx container just to update a static site, or use a bunch of volume mounts for a bunch of different sites instead – neither of which are especially appealing.

Then on top of that you need to make sure Docker is patched and running.

Don’t get me wrong, I love Docker. I have dozens of Dockerized projects on my dev box, deployed Docker countless times, written 100+ blog posts on Docker, created a video course on Docker and I’m a Docker Captain but I don’t use Docker for static sites.

What applications or tasks have you decided not to Dockerize?

Free Intro to Docker Email Course

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.



Comments