Wrong .pbf file (Docker On-Premise)

The wrong pbf file is used when running the docker. A different pbf file must be used (e.g. docker/data/germany-latest.osm.pbf). Here is my docker-compose.yml:

version: '2.4'
services:
  ors-app:
    container_name: ors-app
    ports:
      - 8080:8080
      - 9001:9001
    image: openrouteservice/openrouteservice:latest
    build:
      context: ../
      args:
        ORS_CONFIG: ./conf/ors-config.json
        OSM_FILE: ./data/germany-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-conf
      - ./data/germany-latest.osm.pbf:/ors-core/data/germany-latest.osm.pbf
    environment:
      - BUILD_GRAPHS=False  # 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"

Here is logs:

2022-03-15 13:23:34,338 INFO [ors.Application] - No active profile set, falling back to default profiles: default
2022-03-15 13:23:38,844 INFO [ors.Application] - Started Application in 5.707 seconds (JVM running for 12.488)
2022-03-15 13:23:38,898 INFO [routing.RoutingProfileManager] -  Total - 1.00 GB, Free - 730.76 MB, Max: 2 GB, Used - 295.24 MB
2022-03-15 13:23:38,899 INFO [routing.RoutingProfileManager] -
2022-03-15 13:23:38,990 INFO [routing.RoutingProfileManager] - ====> Initializing profiles from 'data/osm_file.pbf' (1 threads) ...
2022-03-15 13:23:38,991 INFO [routing.RoutingProfileManager] -
2022-03-15 13:23:38,998 INFO [routing.RoutingProfileManager] -
2022-03-15 13:23:39,029 INFO [routing.RoutingProfile] - [1] Profiles: 'driving-car', location: 'data/graphs/car'.
2022-03-15 13:23:40,573 INFO [routing.RoutingProfile] - [1] FlagEncoders: 1, bits used [UNKNOWN]/64.
2022-03-15 13:23:40,574 INFO [routing.RoutingProfile] - [1] Capacity: [UNKNOWN]. (edges - 20863, nodes - 15462)
2022-03-15 13:23:40,578 INFO [routing.RoutingProfile] - [1] Total time: 1.549s.
2022-03-15 13:23:40,578 INFO [routing.RoutingProfile] - [1] Finished at: 2022-03-15 13:23:40.
2022-03-15 13:23:40,579 INFO [routing.RoutingProfile] -
2022-03-15 13:23:40,586 INFO [routing.RoutingProfileManager] - Total time: 1.682s.
2022-03-15 13:23:40,586 INFO [routing.RoutingProfileManager] - ========================================================================
2022-03-15 13:23:40,589 INFO [routing.RoutingProfileManager] - ====> Recycling garbage...
2022-03-15 13:23:40,589 INFO [routing.RoutingProfileManager] - Before:  Total - 1.00 GB, Free - 391.76 MB, Max: 2 GB, Used - 634.24 MB
2022-03-15 13:23:40,727 INFO [routing.RoutingProfileManager] - After:  Total - 1024 MB, Free - 943.23 MB, Max: 2 GB, Used - 80.77 MB
2022-03-15 13:23:40,728 INFO [routing.RoutingProfileManager] - ========================================================================
2022-03-15 13:23:40,732 INFO [routing.RoutingProfileManager] - ====> Memory usage by profiles:
2022-03-15 13:23:40,749 INFO [routing.RoutingProfileManager] - [1] 20.03 MB (24.8%)
2022-03-15 13:23:40,750 INFO [routing.RoutingProfileManager] - Total: 20.03 MB (24.8%)
2022-03-15 13:23:40,750 INFO [routing.RoutingProfileManager] - ========================================================================

Hi,

I think the reason why your docker is falling back to the default data/osm_file.pbf is that you changed the directory where the ORS will take the file

I also had this issue previously, might be the same if you changed back this part.

to

  • ./data/germany-latest.osm.pbf:/ors-core/data/germany-latest.osm.pbf
version: '2.4'
services:
  ors-app:
    container_name: ors-app
    ports:
      - 8080:8080
      - 9001:9001
    image: openrouteservice/openrouteservice:latest
    build:
      context: ../
      args:
        ORS_CONFIG: ./conf/ors-config.json
        OSM_FILE: ./data/germany-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-conf
      - ./data/germany-latest.osm.pbf:/ors-core/data/osm_file.pbf
    environment:
      - BUILD_GRAPHS=False  # 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"

because the docker file inside the ORS directories will find the osm_file.pbf and map your own file based on what you give as the ENV file path.