Search code examples
node.jsdocker-composevolumes

How to load folder into "~/" docker-compose, volumes


One of the modules I am using loads a config file from "~/.oci", but my application cannot see it, since I am using docker (with docker-compose). How do I load a volume into the "~/"-directory inside docker?

I have tried this:

    volumes:
      - ./backend:/app/
      - ./backend/node_modules:/app/node_modules/
      - ~/.oci:~/.oci

Solution

  • The default user is root, and a standard distribution location for the home directory is /root so try

    - ~/.oci:/root/.oci
    

    If your docker container uses a different user, use the USER command and hardcode the home path.