For my first post, I’d like to share the experience of running the in.relation.to blog on my Windows machine.
All the blog content is available on GitHub, and you can practically run the whole site on your local environment.
The Hibernate blog is built with awestruct from Asciidoctor files, and getting all the Ruby gems in place is definite not a walk in the park. To make matters worse, I’m running a Windows machine and all these Ruby gems are tightly coupled to Linux libraries, as I discovered after several failed attempts with the 64 bits Ruby 2.2.4 or the 32 bits Ruby 1.9.3.
Luckily, there is a dockerfile available, so building a Docker image and run it in a dedicated container can tackle the Ruby gem hell. Building the Docker image was fine, but running it was a three hours hackathon for both Emmanuel and I.
Docker images are immutable and all changes are wiped out once the container is terminated. Instead, we want the GitHub repository to be mirrored in the Docker container, so all changes are persisted even after shutting down the docker machine. This process can be done by mounting a host folder into the Docker container, which can happen upon running the Docker image. In our case, the mounted directory is the GitHub repository that’s mirrored inside the currently running Docker container.
Once the image is built, we need to run this command from within the GitHub repository folder:
docker run -t -i -p 4242:4242 -v `pwd`:/home/dev/in.relation.to hibernate/in.relation.to
This doesn’t work on Windows because Docker needs the OS paths to be prefixed with another slash.
So this command must be changed to:
docker run -t -i -p 4242:4242 -v '/'`pwd`:/home/dev/in.relation.to hibernate/in.relation.to
After running it, the mounted folder was just empty. We noticed that without the GitHub folder mounting part the Docker image could run properly, so the mounting process was the culprit.
After all sorts of hacks, Emmanuel had the idea of checking the Virtual Box Shared Folders, and, by default, only the
C:\Users directory is being shared.
No wonder it was not working all along.
All my repositories being on
D:\, we thought that adding a new shared path would fix this issue.
Well, it didn’t.
Docker must mount these Virtual Box shared folders too, but it only does so for
There’s a GitHub issue detailing this behavior, which you can watch if you are interested in this feature.
After moving the checkout GitHub repository to
/c/Users/Vlad/GitHub/in.relation.to, it all worked fine.