Out of Memory Error during Docker Compose

version: '2.4'
    container_name: ors-app
      - 8080:8080
      - 9001:9001
    image: openrouteservice/openrouteservice:latest
#    build:
#      context: ../
#      args:
#        ORS_CONFIG: ./openrouteservice/src/main/resources/ors-config-sample.json
#        OSM_FILE: ./openrouteservice/src/main/files/heidelberg.osm.gz
    user: "${ORS_UID:-0}:${ORS_GID:-0}"
      - ./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
      - ./india-latest.osm.pbf:/ors-core/data/osm_file.pbf
      - 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 -Xmx8g"
      - "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 am trying to load India file. The file size is 1.2GB

2 problems here

  • The build process took nearly 8 hours.
  • And then it failed with Out of Memory error.

Need help on the following

  • What is the ideal configuration values for JAVA_OPTS and CATALINA_OPTS so the out of memory error is solved
  • How can we speed up the build process?

The server on which I am composing the docker is Ubuntu 20.04 with 32GB RAM


have a look at this post regarding system requirements.

Best regards