Getting started with ORS via docker and localhost

I’ve set maximum_locations":10000, maximum_visited_nodes":10000000, in D:\Projects\openrouteservice\docker\conf\app.config.sample and restarted ORS. Either these are not the correct parameters or this is not the right file, because I’m still seeing the error: 10 May 05:24:55 ERROR [errors.CommonResponseEntityExceptionHandler] - org.heigit.ors.exceptions.ServerLimitExceededException: Request parameters exceed the server configuration limits. Only a total of 3600 routes are allowed.

Hi @davideps,

can you please try a new branch fix-docker and let me know if that worked for you?

The app.configwasn’t properly respected inside the container. I fixed that. Now, it also doesn’t matter from where you fire up the container, it will copy a app.config from the container to the host if you map a path to /share (see README in new branch’s Docker dir). Also, the whole image is simplified, so you’d need to rebuild that as well.

It works now for me. But best if you could confirm as well.

Nils, thank you for looking into that issue so quickly. I’ll try the new branch this week.

Hi Nils, I renamed my old OSR directory and issued:
git clone https://github.com/GIScience/openrouteservice --branch fix-docker

I removed existing data, added my own data, edited D:\Projects\openrouteservice\docker\docker-compose.yml and edited D:\Projects\openrouteservice\docker\conf\app.config.sample.

I then issued:
docker-compose up -d --build

It worked well for a while but ended with the error below. My machine runs Windows 10 64bit. Is this error from not issuing the git command properly to merge all the code for the desired branch? Or because of some issue betwen Linux and Windows? I don’t understand why it is still looking for heidelberg.osm.gz after I removed all reference to that file in docker-compose.yml.

-david

Successfully built 9f2e9a895130
Successfully tagged openrouteservice/openrouteservice:v6.1.0
Recreating ors-app ... error                                                                                                                      
ERROR: for ors-app  Cannot start service ors-app: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/host_mnt/d/Projects/openrouteservice/docker/data/heidelberg.osm.gz\\\" to rootfs \\\"/var/lib/docker/overlay2/d9a215fac1371d1b70eb16b940b49f9785d958334195d554504a6654c11374fe/merged\\\" at \\\"/var/lib/docker/overlay2/d9a215fac1371d1b70eb16b940b49f9785d958334195d554504a6654c11374fe/merged/ors-core/data/osm_file.pbf\\\" caused \\\"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

ERROR: for ors-app  Cannot start service ors-app: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/host_mnt/d/Projects/openrouteservice/docker/data/heidelberg.osm.gz\\\" to rootfs \\\"/var/lib/docker/overlay2/d9a215fac1371d1b70eb16b940b49f9785d958334195d554504a6654c11374fe/merged\\\" at \\\"/var/lib/docker/overlay2/d9a215fac1371d1b70eb16b940b49f9785d958334195d554504a6654c11374fe/merged/ors-core/data/osm_file.pbf\\\" caused \\\"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
ERROR: Encountered errors while bringing up the project.

docker-compose.yml and app.config, otherwise I can’t know anything…

I found another mention of heidelberg.osm.gz in the VOLUMES and changed it to refer to my data. Now docker-compose.yml looks like:

version: '3'
services:
  ors-app:
    container_name: ors-app
    ports:
      - 8080:8080
    image: openrouteservice/openrouteservice:v6.1.0
    build:
      context: ../
      args:
        APP_CONFIG: ./docker/conf/app.config.sample
        OSM_FILE: ./docker/data/china-latest.osm.pbf
    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/app.config.sample:/ors-core/openrouteservice/src/main/resources/app.config
      - ./data/china-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 in app.config
      - "JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=8 -Xms4g -Xmx12g"
      - "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"

app.config.sample looks like:

{
  "ors": {
    "info": {
      "base_url": "https://openrouteservice.org/",
      "support_mail": "support@openrouteservice.org",
      "author_tag": "openrouteservice",
      "content_licence": "LGPL 3.0"
    },
    "services": {
      "matrix": {
        "enabled": true,
        "maximum_routes": 1000000,
        "maximum_routes_flexible": 100,
        "maximum_search_radius": 5000,
        "maximum_visited_nodes": 1000000,
        "allow_resolve_locations": true,
        "attribution": "openrouteservice.org, OpenStreetMap contributors"
      },
      "isochrones": {
        "enabled": true,
        "maximum_range_distance": [
          { "profiles": "any", "value": 50000 },
          { "profiles": "driving-car, driving-hgv", "value": 100000 }
        ],
        "maximum_range_time": [
          { "profiles": "any", "value": 18000 },
          { "profiles": "driving-car, driving-hgv", "value": 3600 }
        ],
        "maximum_intervals": 10,
        "maximum_locations": 2,
        "allow_compute_area": true
      },
      "routing": {
        "enabled": true,
        "mode": "normal",
        "routing_description": "This is a routing file from openrouteservice",
        "routing_name": "openrouteservice routing",
        "sources": ["data/osm_file.pbf"],
        "init_threads": 2,
        "attribution": "openrouteservice.org, OpenStreetMap contributors",
        "elevation_preprocessed": false,
        "profiles": {
          "active": [
            "car",
            "bike-regular"
          ],
          "default_params": {
            "encoder_flags_size": 8,
            "graphs_root_path": "data/graphs",
            "elevation_provider": "multi",
            "elevation_cache_path": "data/elevation_cache",
            "elevation_cache_clear": false,
            "instructions": true,
            "maximum_distance": 100000,
            "maximum_distance_dynamic_weights": 100000,
            "maximum_distance_avoid_areas": 100000,
            "maximum_waypoints": 50,
            "maximum_snapping_radius": 400,
            "maximum_avoid_polygon_area": 200000000,
            "maximum_avoid_polygon_extent": 20000,
            "maximum_distance_alternative_routes": 100000,
            "maximum_alternative_routes": 3,
            "maximum_distance_round_trip_routes": 100000,
            "preparation": {
              "min_network_size": 200,
              "min_one_way_network_size": 200,

              "methods": {
                "lm": {
                  "enabled": true,
                  "threads": 1,
                  "weightings": "fastest,shortest",
                  "landmarks": 16
                }
              }
            },
            "execution": {
              "methods": {
                "lm": {
                  "disabling_allowed": true,
                  "active_landmarks": 8
                }
              }
            }
          },
          "profile-car": {
            "profiles": "driving-car",
            "parameters": {
              "encoder_flags_size": 8,
              "encoder_options": "turn_costs=true|block_fords=false|use_acceleration=false",
              "maximum_distance": 100000,
              "elevation": true,
              "maximum_snapping_radius": 350,
              "preparation": {
                "min_network_size": 200,
                "min_one_way_network_size": 200,

                "methods": {
                  "ch": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "fastest"
                  },
                  "lm": {
                    "enabled": false,
                    "threads": 1,
                    "weightings": "fastest,shortest",
                    "landmarks": 16
                  },
                  "core": {
                      "enabled": true,
                      "threads": 1,
                      "weightings": "fastest,shortest",
                      "landmarks": 64,
                      "lmsets": "highways;allow_all"
                  }
                }
              },
              "execution": {
                "methods": {
                  "ch": {
                    "disabling_allowed": true
                  },
                  "lm": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  },
                  "core": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  }
                }
              },
              "ext_storages": {
                "WayCategory": {},
                "HeavyVehicle": {},
                "WaySurfaceType": {},
                "RoadAccessRestrictions": {
                  "use_for_warnings": true
                }
              }
            }
          },
          "profile-hgv": {
            "profiles": "driving-hgv",
            "parameters": {
              "encoder_flags_size": 8,
              "encoder_options": "turn_costs=true|block_fords=false|use_acceleration=false",
              "maximum_distance": 100000,
              "elevation": true,
              "preparation": {
                "min_network_size": 200,
                "min_one_way_network_size": 200,

                "methods": {
                  "ch": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "fastest"
                  },
                  "lm": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "fastest,shortest",
                    "landmarks": 16
                  },
                  "core": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "fastest,shortest",
                    "landmarks": 64,
                    "lmsets": "highways;allow_all"
                  }
                }
              },
              "execution": {
                "methods": {
                  "ch": {
                    "disabling_allowed": true
                  },
                  "lm": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  },
                  "core": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  }

                }
              },
              "ext_storages": {
                "WayCategory": {},
                "HeavyVehicle": {
                  "restrictions": true
                },
                "WaySurfaceType": {}
              }
            }
          },
          "profile-bike-regular": {
            "profiles": "cycling-regular",
            "parameters": {
              "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },
          "profile-bike-mountain": {
            "profiles": "cycling-mountain",
            "parameters": {
              "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },
          "profile-bike-road": {
            "profiles": "cycling-road",
            "parameters": {
              "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },
          "profile-bike-electric": {
            "profiles": "cycling-electric",
            "parameters": {
              "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },
          "profile-walking": {
            "profiles": "foot-walking",
            "parameters": {
              "encoder_options": "block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },
          "profile-hiking": {
            "profiles": "foot-hiking",
            "parameters": {
              "encoder_options": "block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },

          "profile-wheelchair": {
            "profiles": "wheelchair",
            "parameters": {
              "encoder_options": "block_fords=true",
              "elevation": true,
              "maximum_snapping_radius": 50,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "Wheelchair": {
                  "KerbsOnCrossings": "true"
                },
                "OsmId": {}
              }
            }
          }
        }
      }
    },
    "logging": {
      "enabled": true,
      "level_file": "DEBUG_LOGGING.json",
      "location": "/var/log/ors",
      "stdout": true
    },
    "system_message": [
        {
            "active": false,
            "text": "This message would be sent with every routing bike fastest request",
            "condition": {
                "request_service": "routing",
                "request_profile": "cycling-regular,cycling-mountain,cycling-road,cycling-electric",
                "request_preference": "fastest"
            }
        },
        {
            "active": false,
            "text": "This message would be sent with every request for geojson response",
            "condition": {
                "api_format": "geojson"
            }
        },
        {
            "active": false,
            "text": "This message would be sent with every request on API v1 from January 2020 until June 2050",
            "condition": {
                "api_version": 1,
                "time_after": "2020-01-01T00:00:00Z",
                "time_before": "2050-06-01T00:00:00Z"
            }
        },
        {
            "active": false,
            "text": "This message would be sent with every request"
        }
    ]
  }
}

The output is pasted below. I notice it still refers to heidelberg.osm.gz in Step 5/13:

D:\Projects\openrouteservice\docker>docker-compose up -d --build
Creating network "docker_default" with the default driver
Building ors-app
Step 1/13 : FROM openjdk:8-jdk
 ---> cdf26cc71b50
Step 2/13 : ENV MAVEN_OPTS="-Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
 ---> Using cache
 ---> af6f26b40550
Step 3/13 : ENV MAVEN_CLI_OPTS="--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
 ---> Using cache
 ---> e6075eac5890
Step 4/13 : ARG APP_CONFIG=./docker/conf/app.config.sample
 ---> Using cache
 ---> 9c9f6c80932a
Step 5/13 : ARG OSM_FILE=./docker/data/heidelberg.osm.gz
 ---> Using cache
 ---> ae0837442d73
Step 6/13 : WORKDIR /ors-core
 ---> Using cache
 ---> ee3fcc9e178b
Step 7/13 : COPY openrouteservice /ors-core/openrouteservice
 ---> Using cache
 ---> e37a5c20a91d
Step 8/13 : COPY $OSM_FILE /ors-core/data/osm_file.pbf
 ---> Using cache
 ---> 3a5fa84e87dd
Step 9/13 : COPY $APP_CONFIG /ors-core/openrouteservice/src/main/resources/app.config
 ---> Using cache
 ---> beb59d4536ab
Step 10/13 : RUN wget -q https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.32/bin/apache-tomcat-8.0.32.tar.gz -O /tmp/tomcat.tar.gz &&     cd /tmp &&     tar xvfz tomcat.tar.gz &&     mkdir /usr/local/tomcat &&     cp -R /tmp/apache-tomcat-8.0.32/* /usr/local/tomcat/ &&     cd /ors-core &&     apt-get update -qq && apt-get install -qq -y locales nano maven &&     locale-gen en_US.UTF-8 &&     mvn -q -f /ors-core/openrouteservice/pom.xml package -DskipTests &&     cp -f /ors-core/openrouteservice/target/*.war /usr/local/tomcat/webapps/ors.war &&     mkdir /share
 ---> Using cache
 ---> cb3f7234fca1
Step 11/13 : COPY ./docker-entrypoint.sh /docker-entrypoint.sh
 ---> Using cache
 ---> 0eba50b8fceb
Step 12/13 : EXPOSE 8080
 ---> Using cache
 ---> 78d8980ad6f2
Step 13/13 : ENTRYPOINT ["/bin/bash", "/docker-entrypoint.sh"]
 ---> Using cache
 ---> 9f2e9a895130
Successfully built 9f2e9a895130
Successfully tagged openrouteservice/openrouteservice:v6.1.0
Creating ors-app ... done                                                                                                                         
D:\Projects\openrouteservice\docker>docker-compose up
Starting ors-app ... done                                                                                                                         Attaching to ors-app
ors-app    | /docker-entrypoint.sh: line 2: $'\r': command not found
ors-app    | /docker-entrypoint.sh: line 6: $'\r': command not found
ors-app    | /docker-entrypoint.sh: line 33: syntax error: unexpected end of file
ors-app exited with code 2

Ah ok, your whole setup is totally fine. It’s just Windows issue with line endings, they don’t use carriage returns at the end, only newline (I think). Anyways, there’s a thread in this forum somewhere with the same issue. Can’t find it right now though… You basically have to change the line endings somehow. Google should help.

EDIT: this has nothing to do with the initial issue you reported. I guess you fixed that yourself somehow.

OK. I’ll check the forum for the line break issue. There is no problem with it mentioning heidelberg again in step 5/13?

No, that’s just a default value if you don’t provide a OSM_FILE build arg.

I removed the fix-docker branch from my drive and then re-downloaded it, adding --config core.autocrlf=input to the git command. I then modified all the config files. It is working great–I just generated a 100x100 matrix! Thanks for your help.

Aha, that’s a nice git magic! Happy you got it working!