This Docker image installs RVM and then has it install Ruby before installing the Jekyll gem.
$ docker build -t jekyll .
$ docker run --rm --it jekyll "rvm list"
$ docker run --rm --it jekyll "jekyll help"
To do this, you'll need to map a host directory path to a mounted path /vol
in the container. For example:
% docker run --rm -it --volume $HOME/site:/vol jekyll "jekyll new hello"
Running bundle install in /vol/hello...
Bundler: Fetching gem metadata from https://rubygems.org/............
Bundler: Resolving dependencies...
Bundler: Fetching rexml 3.2.6
Bundler: Installing rexml 3.2.6
Bundler: Fetching jekyll-feed 0.17.0
Bundler: Fetching jekyll-seo-tag 2.8.0
Bundler: Installing jekyll-feed 0.17.0
Bundler: Installing jekyll-seo-tag 2.8.0
Bundler: Fetching minima 2.5.1
Bundler: Installing minima 2.5.1
Bundler: Bundle complete! 7 Gemfile dependencies, 33 gems now installed.
Bundler: Use `bundle info [gemname]` to see where a bundled gem is installed.Don't run Bundler as root. Installing your bundle as root will break this
Bundler: application for all non-root users on this machine.
New jekyll site installed in /vol/hello.
% ls $HOME/site
hello