Jekyll Serve --Drafts on Windows in Docker Container

When using the official jekyll/jekyll:3.8 docker image on Windows I am having problems serving the drafts. See my repo docker-compose.yml, _config.yml and _config.docker.yml files for specific flags and configuration.

I was following this guide and I am able to serve without --drafts fine.

I am seeing different urls in the html generated by any post under _drafts/ compared to the html generated from _posts/. The drafts generated html shows links to http://0.0.0.0:4000 while the posts html shows the correct http://localhost:4000.

OS details:

  • Windows 10 Pro version 1909

I tested this on linux and the drafts are served fine and the html is as expected. Maybe it is permissions in the docker container. What does --skip-initial-build do?

That seems strange to me. If not a config issue then a bug.

For local use you will not see a difference between the 0.0.0.0 and localhost esp if you use localhost:4000

So maybe let it be. If you are deploying the container you would keep drafts disabled. And you’ll set hostname as a Jekyll flag or config value based on your serving domain.
If setting url for hostname in config, also set jekyll env to production.

1 Like

Skip initial build is a flag on serve command to start jekyll server without building the site directory first.
Perhaps remove it if you’re using it.

1 Like

The docker permissions won’t affect Jekyll URLs. Jekyll doesn’t know it’s in a container, it just uses localhost or a given hostname.

You could set hostname or url flag to actually be 0.0.0.0 or localhost and see what happens.

1 Like