Skip to content

Instantly share code, notes, and snippets.

@mrryanjohnston
Created January 31, 2014 07:23
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrryanjohnston/8727858 to your computer and use it in GitHub Desktop.
Save mrryanjohnston/8727858 to your computer and use it in GitHub Desktop.
Running Jekyll from a Docker container. Uses a busybox container to host the Jekyll data (see http://docs.docker.io/en/latest/use/working_with_volumes/).
# Assuming your Jekyll site is currently in ~/blog
$ sudo docker run -v /home/yourusername/blog:/src -name BLOG-DATA busybox true
# Using the Dockerfile in the current dir
$ sudo docker build -t ubuntu-jekyll .
# Run this container as a daemon using the volumes from the BLOG-DATA container,
# forwarding the container port 4000 to the host port 4000.
$ sudo docker run -volumes-from BLOG-DATA -d -p 4000:4000 -name jekyll ubuntu-jekyll
# Now you can edit your Jekyll site in the host with your favorite editor without installing Ruby in the host!
FROM ubuntu:12.04
#Install Ruby
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install ruby1.9.1 ruby1.9.1-dev make
#Pygments doesn't seem to want to work regardless of version installed
RUN gem install pygments.rb
#Install Jekyll
RUN gem install jekyll
WORKDIR /src
EXPOSE 4000
CMD ["jekyll", "serve", "--watch"]
@ilonajulczuk
Copy link

Hi, I've just tried and javascript runtime was missing.

Adding nodejs to apt-get dependencies solves this issue :). Thanks for dockerfile.

Copy link

ghost commented May 5, 2015

I saw your comment about Pygments not working. I was able to clear it up and use GFM fenced code blocks using kramdown-with-pygments plug-in. Here's my _config.yml for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment