I am unable to build the jekyll site I cloned with git due to a permission error. I am using Ubuntu 18.04. I've looked at most SO posts regarding this error, but none of the solutions have worked for me.
The command to build the site is docker-compose up. Running this command with or without sudo does not change the error. I am in the docker group. I am able to build the site using bundle exec jekyll serve. This command successfully creates the _site folder.
I tried adding the _site manually, but this results in a different error.
$ docker-compose up
Starting site ... done
Attaching to site
site | Configuration file: /srv/jekyll/_config.yml
site | Source: /srv/jekyll
site | Destination: /srv/jekyll/_site
site | Incremental build: disabled. Enable with --incremental
site | Generating...
site | Jekyll Feed: Generating feed for posts
site | jekyll 3.8.5 | Error: Permission denied @ dir_s_mkdir - /srv/jekyll/_site
site exited with code 1
docker-compose.yml
version: '3'
services:
doc:
image: jekyll/jekyll:3.8
volumes:
- .:/srv/jekyll
container_name: site
ports:
- "4000:4000"
stdin_open: true
tty: true
command: bash -c "bundle install && bundle exec jekyll serve --host 0.0.0.0"
I am expecting to get no errors and have the _site directory successfully created.
.
refers to your host's current directory. What are the permissions on that directory? Who is the owner? It would be better to replace.
with./jekyll
and put in the new directory whatever files you need. Then you can try and give more write rights to this directory. – Mihaidrwxr-xr-x 12 addison addison 4.0K Aug 14 15:50
. – Addison- ./_site:/srv/jekyll/_site
This way the folder will be created by docker-compose with the correct permissions. – Mihaichmod ugo+rwx site
and then usingdocker-compose up
. When I add the line you suggested, I get another errorjekyll 3.8.5 | Error: Permission denied @ rb_sysopen - /srv/jekyll/_site/blog.html
. I am not exactly satisfied with my solution, as I have other peers that do not have to modify their directory permissions, or change the docker-compose.yml file. – Addison