requarks / wiki

Wiki.js | A modern and powerful wiki app built on Node.js
https://js.wiki
GNU Affero General Public License v3.0
24.25k stars 2.68k forks source link

docker-compose: config.yml file not mounting #242

Closed sam-artuso closed 6 years ago

sam-artuso commented 6 years ago

I'm trying to run wiki.js with docker-compose.

I have created a config.yml file in the same directory where my docker-compose.yml file is.

Upon running docker-compose up I get this error:

ERROR: for f2adea891bfc_wikijs_wikijs_1  Cannot start service wikijs: oci runtime error: container_linux.go:262: starting container process caused "process_linux.go:339: container init caused \"rootfs_linux.go:57: mounting \\\"/home/kyuzz/Projects/wiki.js/config.yml\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/31f21efbed605dfa8ca525bb35008986830950c86ef9f019117e57696500b17e\\\" at \\\"/var/lib/docker/aufs/mnt/31f21efbed605dfa8ca525bb35008986830950c86ef9f019117e57696500b17e/var/wiki/config.yml\\\" caused \\\"not a directory\\\"\""
: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

How can I fix this issue?

sam-artuso commented 6 years ago

@NGPixel any clues?

sam-artuso commented 6 years ago
$ docker --version
Docker version 17.06.0-ce, build 02c1d87
$ docker-compose --version                
docker-compose version 1.16.1, build 6d1ac21
NGPixel commented 6 years ago

I was able to run docker-compose without any issues, so you must likely have a wrong path in your docker-compose.yml.

In my test, I used the following docker-compose.yml:

version: '3'
services:
  wikidb:
    image: mongo
    expose:
      - '27017'
    command: '--smallfiles --logpath=/dev/null'
    volumes:
      - /home/nick/test/mongo:/data/db
  wikijs:
    image: 'requarks/wiki:latest'
    links:
      - wikidb
    ports:
      - '8000:3000'
    environment:
      WIKI_ADMIN_EMAIL: admin@example.com
    volumes:
      - /home/nick/test/config.yml:/var/wiki/config.yml

and for the config.yml, I simply copied the sample file and changed the db param to match the docker compose name:

db: mongodb://wikidb:27017/wiki
bkraul commented 6 years ago

If anyone goes through this, the reason is that the config.yml file (as per the instructions) needs to be created before starting the container. If this is not done, the process will create a directory called config.yml in wherever your volume is mapped to. After that, even if you correct it by deleting the folder and creating the file, it will not work until you remove the containter and re-run it. Took me a while to figure out.