Docker - Jekyll Container Setup


Here I describe my setup of the Jekyll container.

I run this Docker container on a Ubuntu VM that runs via [[ Proxmox VE ]]. I perform the following on the CLI.

Docker pull command:

docker pull jekyll/jekyll

Within my home folder I have created a Docker folder where I create a subfolder for each container:

cd ~
mkdir -p docker/jekyll
cd docker/jekyll
mkdir cache
mkdir build

I use the Nano text editor to create a shell script:

sudo nano jekyll_run.sh

With this shell script we are going to create the container. Copy the following into jekyll_run.sh:

IDu=$(id -u $(logname)) # Saves the logged in user id in the IDu variable
IDg=$(id -g $(logname)) # Saves the logged in user group in the IDg variable

docker run -d \
 -p 0.0.0.0:4000:4000 \
 --hostname=jekyll \
 --name=jekyll \
 -v /mnt/fileserver/archive/github/fictionbecomesfact:/srv/jekyll \
 -v $PWD/cache:/usr/local/bundle \
 -v $PWD/build:/srv/jekyll/build \
 -e 'TZ=Europe/Amsterdam' \
 -e JEKYLL_UID=$IDu \
 -e JEKYLL_GID=$IDg \
 jekyll/jekyll \
  jekyll serve --source /srv/jekyll \
  --destination /srv/jekyll/build \
  --disable-disk-cache \
  --watch \
  --force_polling \

If necessary, adjust the following:

-p 0.0.0.0:4000:4000
Choose a port that is still available, I chose 4000. Check this with netstat

-v /mnt/fileserver/archive/github/fictionbecomesfact:/srv/jekyll
Choose the location of the website. In this example, it’s a shared folder created as mount on the Ubuntu VM

-e ‘TZ=Europe/Amsterdam’
Pick the right timezone

Exit Nano (CTRL-X) and save the changes.

Now create the container:

sudo sh jekyll_run.sh

Check if the container is running properly.

Using Jekyll

The log shows that it may take a while for the server to run. After that, the website can be reached via the URL:

http://<IP DOCKER SERVER>:4000/

If changes are made to the source code or to notes (e.g. with Obsidian) Jekyll will automatically detect the changes and generate a new build.

Tip: optionally you can install Visual Studio Code Server to edit the source code via the browser

See also my notes about updating containers with Portainer or via the CLI. With Synology’s Docker Application, updating a container is also very easy.


Read other notes

Comments

    No comments found for this note.

    Join the discussion for this note on this ticket. Comments appear on this page instantly.

    Tags


    Notes mentioning this note


    Notes Graph