Docker WSL2 : error mounting -docker compose

Hello,

I am trying to get openrouteservice to run on my local machine. I am using WSL2 and I run everything on my ubuntu on Windows terminal.

Based on this : Advanced Docker Setup - openrouteservice documentation, I changed the OSM data (to data corresponding to New York).
and I get the following error :

"Cannot start service ors-app: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/87b492e6d64c03494e2cc23ea5e9ed14ad9bbb91ef4265a2bd5d7f8f0da57ad2" to rootfs at "/ors-core/data/osm_file.pbf": mount /run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/87b492e6d64c03494e2cc23ea5e9ed14ad9bbb91ef4265a2bd5d7f8f0da57ad2:/ors-core/data/osm_file.pbf (via /proc/self/fd/14), flags: 0x5000: not a directory: unknown: 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" 

Here is what my docker-compose.yml file looks like :

version: '2.4'
services:
  ors-app:
    container_name: ors-app
    ports:
      - 8080:8080
      - 9001:9001
    image: openrouteservice/openrouteservice:latest
    build:
      context: ../
      args:
        ORS_CONFIG: ./openrouteservice/src/main/resources/ors-config-sample.json
        OSM_FILE: ./data/osm/new-york-latest.osm.pbf 
    user: "${ORS_UID:-0}:${ORS_GID:-0}"
    volumes:
      - ./graphs:/ors-core/data/graphs
      - ./elevation_cache:/ors-core/data/elevation_cache
      - ./logs/ors:/var/log/ors
      - ./logs/tomcat:/usr/local/tomcat/logs
      - ./conf:/ors-config
      - ./data/osm/new-york-latest.osm.pbf:/ors-core/data/osm_file.pbf
    environment:
      - BUILD_GRAPHS=True  # Forces the container to rebuild the graphs, e.g. when PBF is changed
      - "JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:ParallelGCThreads=4 -Xms1g -Xmx2g"
      - "CATALINA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.rmi.port=9001 - Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost" 

I think that the error has to do with the fact that files are mounted differently in Windows and in Linux and I am not sure how WSL does the path translation.

I tried the workaround that I found here : Docker-compose and incorrect absolute paths for volumes · Issue #1854 · microsoft/WSL · GitHub

$ sudo mount --bind /mnt/c /c
$ cd /c/path/to/project
$ docker-compose ...

but it was not successful for me

A quick observation though is that if I comment this line of the docker-compose.yml

./data/osm/new-york-latest.osm.pbf:/ors-core/data/osm_file.pbf

ors-app is installed correctly on my local machine and is ready to run. My question is : why do the other files get read correctly but not one the one concerning the osm_file ?

If other users on WSLhave encountered this problem, it would be very helpful for me to get a sense of their experience with this issue.

Thanks in advance.

P.S : I’m very new to programming and to Docker, so please be kind :slight_smile:

Hi,

I’m able to run ORS locally using docker and WSL2. Are you sure that the ./data/osm/new-york-latest.os.pbf file exists with that exact path from where you are running docker-compose up?