Windows installation Docker command issues - load custom pbf no longer works

I’ve managed to get a local install of ORS working on Windows/Docker before several times, but every time I come back to it after a few months, something has changed which requires some kind of change to my process. I’m struggling to figure out how to load a specific .pbf file. This used to be easy using a command like…

"C:\OpenRouteService\custom.pbf":/home/ors/ors-core/data/osm_file.pbf

…however I’ve noticed that the above command doesn’t work any more because the /home/ors/ors-core/data directory seems to have been confusingly abolished.

Here are my steps:

  1. Execute this command in the windows command prompt. I used to use ‘latest’ instead of ‘nightly’ but was told that ‘latest’ is not actually updated. Advice welcome on which version to use!
    docker pull openrouteservice/openrouteservice:nightly

  2. Then run this windows command which does all the important stuff, and which I’ve adapted based on advice here and here
    docker run -dt --name ors-app -p 8080:8082 -v C:/OpenRouteService/graphs:/home/ors/graphs -v C:/OpenRouteService/elevation_cache:/home/ors/elevation_cache -v C:/OpenRouteService/logs/ors:/home/ors/logs -v C:/OpenRouteService/conf:/home/ors/config -v "C:\OpenRouteService\italy-latest.osm.pbf":/home/ors/files/osm_file.pbf -e "JAVA_OPTS=-Xms2g -Xmx4g" openrouteservice/openrouteservice:nightly

Firstly is this the correct approach? I wish that instructions for Windows users were provided, it would surely lead to more widespread adoption of ors! How do I load my custom pbf?

And why do the folders keep changing? For example why has :/home/ors/ors-core/data/graphs become :/home/ors/graphs and how are we meant to keep up with these changes?

Thanks in advance.

I found a solution! On this page there’s a hidden dropdown box which has the answers Running with Docker | openrouteservice backend documentation

It looks like I also had the syntax wrong to boost the RAM memory allocation. The command below worked fine, and could be useful for any other Windows users out there. Thanks

docker run -dt --name ors-app -p 8080:8082 -v C:/OpenRouteService/graphs:/home/ors/graphs -v C:/OpenRouteService/elevation_cache:/home/ors/elevation_cache -v C:/OpenRouteService/logs/ors:/home/ors/logs -v C:/OpenRouteService/conf:/home/ors/config -v C:/OpenRouteService/files:/home/ors/files -e "XMS=1g" -e "XMX=8g" -e "ors.engine.source_file=files/italy-latest.osm.pbf" openrouteservice/openrouteservice:nightly

1 Like

For those out there struggling with this scenario, considering I’ve been there much like Baycode, take a look at this sample repo I’ve created - GitHub - rjsvieira/openrouteservice: 🌍 The open source route planner api with plenty of features.

2 Likes

Hi,

For your knowledge, the correct path for the PBF file has changed. Based on your updated command, it should work by placing your .pbf file in the files directory. Your current command is correct:

-v "C:\OpenRouteService\italy-latest.osm.pbf":/home/ors/files/osm_file.pbf

ORS Docker images might evolve over time, leading to changes in the directory structure. To stay updated, I recommend checking the official OpenRouteService Docker repository and Kubernetes vs Docker for any documentation updates or changes to the folder paths.

Thanks

1 Like

Hi @alexthomas it looks like I need to tweak my windows command for changes in v9.0.0

Here is what I used to use, which forces a rebuild using my custom pbf:

docker run -dt --name ors-app -p 8080:8082 -v C:/OpenRouteService/graphs:/home/ors/graphs -v C:/OpenRouteService/elevation_cache:/home/ors/elevation_cache -v C:/OpenRouteService/logs/ors:/home/ors/logs -v C:/OpenRouteService/conf:/home/ors/config -v C:/OpenRouteService/files:/home/ors/files -e "XMS=1g" -e "XMX=8g" -e "ors.engine.source_file=files/custom.pbf" openrouteservice/openrouteservice:nightly

However I’ve noticed now that it still uses the xample-heidelberg.test.pbf and ignores my custom.pbf

Can you help to update my windows command please? Or do I need to edit “C:\OpenRouteService\conf\ors-config.yml” with the pbf location? If so, how do I rebuild once the yml is updated? Thanks

Problem solved - as usual, there was a subtle change in the command format which now requires this:

Add -e "ors.engine.profile_default.build.source_file=files/your.osm.pbf" \ to point to your own OSM file

Thank goodness it was documented here Running with Docker | openrouteservice backend documentation

Im also trying to mount it with Italian data, but i dont reach to point the pbf file i dont know why in the docker compose… # Docker Compose file for the openrouteservice (ORS) application

Documentation and examples can be found on Running with Docker | openrouteservice backend documentation

version: ‘3.8’

services:

----------------- ORS application configuration -------------------

ors-app:
# Activate the following lines to build the container from the repository
# You have to add --build to the docker compose command to do so
build:
context: ./
container_name: ors-app
ports:
- “8080:8082” # Expose the ORS API on port 8080
- “9001:9001” # Expose additional port for monitoring (optional)
image: openrouteservice/openrouteservice:v8.0.0
# Advanced option! If you different ids to 0:0 and 1000:1000, you have to rebuild the container with the build args UID,GID.
# The user command is useful if you want easier bind mount access or better security.
#user: “1000:1000” # Run “mkdir -p ors-docker/config ors-docker/elevation_cache ors-docker/files ors-docker/graphs ors-docker/logs && sudo chown -R 1000:1000 ors” before starting the container!
volumes: # Mount relative directories. ONLY for local container runtime. To switch to docker managed volumes see ‘Docker Volumes configuration’ section below.
- ./ors-docker:/home/ors # Mount the ORS application directory (for logs, graphs, elevation_cache, etc.) into its own directory
# - ./italy-latest.osm.pbf:/ors-docker/data/osm_file.pbf
#- ./graphs:/home/ors/graphs # Mount graphs directory individually
#- ./elevation_cache:/home/ors/elevation_cache # Mount elevation cache directory individually
#- ./config:/home/ors/config # Mount configuration directory individually
#- ./logs:/home/ors/logs # Mount logs directory individually
#- ./files:/home/ors/files # Mount files directory individually
environment:
REBUILD_GRAPHS: False # Set to True to rebuild graphs on container start.
CONTAINER_LOG_LEVEL: INFO # Log level for the container. Possible values: DEBUG, INFO, WARNING, ERROR, CRITICAL
# If you don’t want the default ors-config.yml you can specify a custom file name, that should match the file in
# your ‘config’ volume mount.
#ORS_CONFIG_LOCATION: /home/ors/config/my-ors-config.yml # Location of your ORS configuration file in the docker container

  # ------------------ JAVA OPTS ------------------ #
  # Configure the memory settings for JAVA or pass additional opts
  # Fore more available ENV properties see Prepare CATALINA_OPTS and JAVA_OPTS
  # in https://github.com/GIScience/openrouteservice/blob/main/docker-entrypoint.sh
  XMS: 1g  # start RAM assigned to java
  XMX: 2g  # max RAM assigned to java. Rule of Thumb: <PBF-size> * <profiles> * 2
  # Example: 1.5 GB pbf size, two profiles (car and foot-walking)
  # -> 1.5 * 2 * 2 = 6. Set xmx to be AT LEAST `-Xmx6g`
  ADDITIONAL_JAVA_OPTS: ""  # further options you want to pass to the java command

  # ----------------- Properties configuration ------------------- #
  # Configure your whole container with only property ENVs.
  # These can be set alternatively or additionally to the yml configuration file.
  # Note, that any values set will override the corresponding values from the yml configuration file.
  # See the ors-config.env file for more options.
  # To have a configuration file-less container, uncomment at least the following properties.
  # The values are examples and provide the default configuration.
  ors.engine.profile_default.build.source_file: ./home/ors/files/italy-latest.osm.pbf
  #ors.engine.graphs_root_path: /home/ors/graphs
  #ors.engine.elevation.cache_path: /home/ors/elevation_cache
  #ors.engine.profiles.car.enabled: true

# ----------------- ENV file configuration ------------------- #
# Too many variables for your 'environment:' section?
# Use an env_file with the ENV properties instead and define everything in there:
# Values will be overwritten if set in the 'environment' section.
#env_file: ors-config.env

# ----------------- Healthcheck configuration ------------------- #
# The healthcheck is disabled by default. Uncomment the following lines to enable it.
# The healthcheck allows you to monitor the status of the ORS application.
# Be careful with long graph builds, as the healthcheck will fail and show 'unhealthy' during this time.
# This is especially useful if you run your ORS container in a production environment.
#healthcheck:
#  test: wget --no-verbose --tries=1 --spider http://localhost:8082/ors/v2/health || exit 1
#  start_period: 1m
#  interval: 10s
#  timeout: 2s
#  retries: 3
#  disable: false

----------------- Docker Volumes configuration -------------------

Define the Docker managed volumes for the ORS application. For more info on Docker Volumes see Volumes top-level element | Docker Docs

Volumes are used to persist the data and configuration of the ORS application.

If you want to use volumes, uncomment the following lines and remove the ./ prefix from the volume paths in ‘services.ors-app.volumes’.

#volumes:

graphs:

elevation_cache:

config:

logs:

files: