My Take at Nikola, orgmode, docker

This site is built with Nikola and runs on GitLab. Moreover, it is deployed automatically using Travis CI. I recently needed to set up for Nikola and orgmode and figured, why not write about it so that I can have my own reference if I had to do it again.


I use docker in this case. Nikola is written in Python and could be easily installed both system-wide or in virtualenv but I opted for a docker image to keep it streamlined and have the ability to use the same docker image for the Travis CI. Install docker. I used the available at the time dockerfile ( which needed a small tweak: emacs (and thus orgmode) support. My setup, including .gitlab-ci.yml is here:

Note: At the time, I just wanted to get started on something. Today, I notice that there is another dockerfile using docker-compose available: YMMV, I guess.

Install docker

sudo -S apt-get remove docker docker-engine

(The added bonus is that the code in the .org source file can be executed directly with C-c C-c)

sudo apt-get install \
     apt-transport-https \
     ca-certificates \
     curl \
curl -fsSL | sudo apt-key add -

On Ubuntu:

sudo add-apt-repository \
    "deb [arch=amd64] \
    $(lsb_release -cs) \

(other distributions, see:

sudo apt update
sudo apt-get install docker-ce

You will probably want to add your user to docker group.


To be honest, I chose Nikola because it's Python. I've considered Jekyll, I've flirted with Pelican (Python as well) but got a good Nikola vibe. I have not yet customized anything, I did not write a line of code. Well, I admit, one feature that tipped over in favor of Nikola was orgmode support.


I have been using orgmode for several years now. I have been using it as a ToDo list, project management, agenda, I have done some writing in it, I toyed with music typesetting with orgmode and Lilypond, literate programming is a bit tempting as well. Orgmode works for me also just as a simple markup language and it will export your sweat into many, many formats.


Initial setup

  • Install docker.
  • Get my docker file git clone
  • Inside the checked dorectory: docker build -t nikola .
  • Then read about docker registry:
    • Once I've figured out my access to the gitlab registry, I do:
    • docker login
    • from the docker repo: docker build -t . and then docker push

I can run the nikola docker image locally as such

docker run --rm -v $PWD:/site -w /site -u $(id -u):$(id -g) -p 8877:8000 nikola nikola

Writing, deploying.

To create this post I used the following command

docker run --rm -v $PWD:/site -w /site -u $(id -u):$(id -g) -p 8877:8000 nikola nikola new_post -f orgmode -t "My Take at Nikola, orgmode, docker" -a MiS --tags="orgmode,docker,nikola" -e

This command will serve serve the thing for inspecting locally on port 8877.

docker run --rm -v $PWD:/site -w /site -u $(id -u):$(id -g) -p 8877:8000 nikola nikola serve

Commit and push to gitlab repo, once configured, will automatically build the site.


Comments powered by Disqus