In my last post, I pretty much slammed Wordpress and mentioned that I was using a Jekyll container to convert simple paragraphs ( Markdown files ) into web pages. Well, when I went to update my blog with my first post, I ran into a few issues that meant that the post never actually made it onto the blog.

Since I’m here at these crossroads now, I’ll blog about the issue that prevented Jekyll from working. In a word, the issue seems to be ‘docker-machine’.

I’m relatively new to container tech. To get Docker running on my laptop ( MacBook Air ), I first went to Docker. They had a friendly Mac install, and I soon found myself running hello-world ( through VirtualBox ). I don’t recall why, but I also found myself checking out Vagrant. Through Vagrant, I found myself running a similar container. I didn’t really see the difference between the two.

Well, one possible difference concerns the issue that I had with docker-machine when I tried to run the Jekyll container: docker doesn’t actually run on the Mac. Instead, docker-machine does this weird thing where it sets environment variables, and the docker command can then be magically accessed. At least for a while. In the case of the Jekyll container, when I was originally setting up my blog, I had set up the container with no issues, and then run it many times, with no issues. Then I had shut down the container. I had anticipated that it would just sit there, and be ready when I needed it. After all, it was a container: if it ran once successfully, since nothing persists in containers unless written to specially mounted volumes, then it should run perfectly, every time.

As I mentioned, that was not the case. I was getting errors from docker. ( I have since stopped using docker-machine on the mac, so I can’t cite what they were. )

I recalled that I had also seen this at work. I had been unable to find a solution on Google, and had ultimately found a post where an error that seemed fundamental enough that it really needed to be fixed, remained in an un-fixed state after some time. Months? Years? I really don’t recall. But I did know that I needed the thing I was working on to be fixed today, so I reimplemented it using Vagrant instead:

I recalled finding a nice image in a Vagrantfile produced by a group that calls themselves Phusion when I was trying to get a container going with grafana and graphite. Instead of relying on magically accessing the docker command, a VM was created by Vagrant that itself ran docker.

It could very well be that I’m just not running docker-machine the correct way. That maybe something happens when I shut my laptop and put it into sleep mode. Or maybe I need to shut down the terminal where I set the environment variables. However, when discussing this with my supervisor later that day, he commented that he had ditched docker-machine for Vagrant, as well. From a user-experience perspective, Vagrant just works.

The Jekyll container approach to blogging on github was mentioned in a docker/cloud meetup that I went to. After the meetup, Boyd posted the link to his blog where he details how to set it up.

Because I ran into the same issues that I ran into at work with docker-machine, I intend to set a Jekyll container environment up in Vagrant, which I consider to be much more stable.

So the process will look like this:

  • Configure a github.io account
  • Install Vagrant and VirtualBox
  • Get and build the VM that runs Docker
  • Within the image, build the Jekyll image
  • Run the Jekyll image
  • Set up a base blog
  • Make a change, commit the repo

Now that I’ve listed the steps out, it doesn’t seem as straightforward as it did in my head. Then again, consider that what I am aiming to do is to build an environment that will convert simple paragraphs to a version-controlled ( backed up ) blog ( that can be worked on, though not updated ) without an internet connection – in effect, build a blogging platform that replaces the need for Wordpress ( for simple content ).

I don’t mind taking a few extra steps to get this set up, so long as the end result is that I can run it at will, when I want to, and the work is backed up.

Once this blog is set up, the creative process should look like this:

  • vagrant up / vagrant resume
  • make local changes to markdown files
  • run mangling scripts ( for the dual-theme static site )
  • check local copy
  • commit changes to (web) source repo
  • vagrant halt / vagrant suspend

( all of that can be done without access to the net ), then, when the net is accessible:

  • push changes to source repo
  • cd into _site directory, push changes to site repo

The last step will result in updating the live site.

Hmm. Still seems like a long list. But I think the tradeoff will be worth it.

Update ( March 3, 2016 ) :

I’m now blogging with a Mac through a Vagrant-Docker-Jekyll combo. No mysterious “can’t access the VM / container issues”, though there was an odd caching issue with icons that I solved by removing all the icons and then restarting the vagrant box.

I’ll include all the steps I took to get this monster working soon!