wiki-v1 icon indicating copy to clipboard operation
wiki-v1 copied to clipboard

Confusion about wikijs configuration and setup in docker container

Open pdavis68 opened this issue 6 years ago • 2 comments

I'm using Docker for Windows... Using the example provide here:

https://github.com/Requarks/wiki/blob/master/tools/docker-compose.yml

I seem to have issues with my volumes. For example, ./config.yml:/var/wiki/config.yml would presumably map the config.yml in the directory from where I'm executing docker-compose up to the /var/wiki directory in my docker container. But there is no wiki directory under my /var directory.

So, this is my docker-compose.yml that I actually use. I've tried replacing ./ with //./ but that doesn't address my issues...

version: '3'
services:

  wikidb:
    image: mongo:3
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: expassword 
      
    volumes:
        - /mongo/data/db:/data/db
        - ./data/mongod.conf:/etc/mongod.conf
        
  wikijs:
    image: 'requarks/wiki:latest'
    links:
      - wikidb
    depends_on:
      - wikidb
    ports:
      - '1081:3000'
    environment:
      WIKI_ADMIN_EMAIL: [email protected]
    volumes:
      - ./config.yml:/var/wiki/config.yml        
      - ./logs:/logs

From the directory where I run docker-compose up...

If I run with ./, I get no mongod.conf in my etc folder. I get no /logs folder in my root.

I do have the mongo volume that I've created separately, outside of all this and that's used properly....

Now, if I replace './' with '//./', in the container, I get a /data directory in the root with a mongod.conf directory, but not the actual mongod.conf file which is my host data directory. And obviously, it's backwards. It should be mongod.conf in the etc folder, not in the data folder.

What's going on? How do I straighten this all out? Thanks

pdavis68 avatar Sep 30 '18 20:09 pdavis68

Try: https://github.com/docker/compose/issues/4303#issuecomment-379563170

However, on Windows, you should instead use absolute paths instead.

NGPixel avatar Oct 01 '18 02:10 NGPixel

I tried that. Replacing the ./ above with //F/docker/wikijs (the above yml is in F:\docker\wikijs, I end up getting a folder in the root called F which then has docker and then wikijs under it. It then shows config.yml as a directory, my "data" directory (which is empty in the container, but has a directory and file in the host), and the logs folder which, in the container, contains supervisord.log, wiki-stderr.log and wiki-stdout.log, but these files are not on the host.

This is the config file with the replacements:

version: '3'
services:

  wikidb:
    image: mongo:3
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: expassword 
      
    volumes:
        - /mongo/data/db:/data/db
        - //F/docker/wikijs/data/mongod.conf:/data/mongod.conf
        
  wikijs:
    image: 'requarks/wiki:latest'
    links:
      - wikidb
    depends_on:
      - wikidb
    ports:
      - '1081:3000'
    environment:
      WIKI_ADMIN_EMAIL: [email protected]
    volumes:
      - //F/docker/wikijs/config.yml:/var/wiki/config.yml        
      - //F/docker/wikijs/logs:/logs

Using F:/ instead of //F/ yields the same result except that the "F" directory becomes a lowercase "f".

pdavis68 avatar Oct 01 '18 04:10 pdavis68