Earlier this year, I shared an update to a previous video demonstrating how to run GitHub Pages (Jekyll) in a Docker container. I am pleased to announce the final, published version. Some of you gave me great feedback. I updated what I could, and thank you very much!
The benefits of using Docker are you do not have to install Ruby, Jekyll, and all those dependencies on your computer. Instead, you run them in an Ubuntu Linux container (think of it as a sort of template containing all the things you need to run a new GitHub Pages/Jekyll site).
The video
What you will learn
About GitHub Pages and Jekyll
About Docker
How to build a Docker Image (template) to build any GitHub Pages website
How to override themes
How to fork an existing GitHub Pages website into a Docker container
Much more!
Enjoy!
P.S. My old video using Alpine Linux is no longer listed on my YouTube channel, but it is still available to watch if you link to it for other people. I renamed it to “OLD” in the title and provided a link to the new video in the description.
I explain it in depth at the beginning of the video, but the idea in more detail. They basic idea is you can install Ruby, Jekyll, and all dependencies in a container so you do not need to install it on your computer.
New video: Develop GitHub Pages (Jekyll) using Docker - Share - Jekyll Talk (jekyllrb.com)
Hi Bill,
I’ve watched your video (it’s great) but I was wondering… Do I need to create a new container for each jekyll project that Im building? I used the GitHub Pages Jekyll Dockerfile gist for my first project, do I need to repeat that same process for each new project?
Thank you, @JackieGable! I highly recommend you create a new container (Dockerfile) for each website. That means each website (with Dockerfile) is also a new GitHub repo.
For example, I own three websites. Each website is a GitHub Repo with a Dockerfile with Jekyll installed. I update one of them weekly, so I like to keep it up to date with the latest version of Jekyll and related dependencies. The other websites use older versions of Jekyll, but they are mostly just marketing sites that change maybe 1-2 times a year, so I do not maintain them as much. Since they are each self-contained, I do not have to worry about fixing a website so that it uses the latest technology.
If you are still wondering if that is a good fit for you, feel free to ask any clarifying questions.
Hi Bill, I’m getting frustrated with the live-reload feature not working on my Windows 10 computer. I’ve read thru all the posts on here and S.O., have applied all the suggested fixes but it still doesn’t work and I have to constantly refresh the page each time I want to see the changes. Does the live-reload feature work when running Jekyll in a Docker Container?
As @rdyar mentions, there are a few ways to use livereload. I use:
bundle exec jekyll serve --livereload
If you are not getting the refreshes, there are some reasons for why this may fail. See if any of these help you:
Look for errors or significiant warnings during your build. Sometimes Jekyll builds but it warns you about site content that may cause issues. Look for those when you build the site
Perhaps your browser is locked down? Maybe there are settings that prevent prevents auto-refeshing? Download some other browser, like Firefox onto your computer and try from there. If you install a browser you typically do not work with and the refresh works, then it comes down to browser settings
If you are adding some sort of framework to Jekyll to make it easier to build your site like Tailwind or Bootstrap, temporarily remove it.
Another approach is to build a basic jekyll site from scratch using jekyll new testsite and then running it using bundle exec jekyll serve --livereload and testing from there