zubair1024
12/21/2019 - 8:10 PM

OSRM using Docker

Setting up OSRM backend using Docker

  • Download map layer from source

wget https://download.geofabrik.de/asia/gcc-states-latest.osm.pbf

  • Pre-process the extract with the car profile and start a routing engine HTTP server on port 5000

docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-extract -p /opt/car.lua /data/gcc-states-latest.osm.pbf

Note: The flag -v "${PWD}:/data" creates the directory /data inside the docker container and makes the current working directory "${PWD}" available there. The file /data/*.osm.pbf inside the container is referring to "${PWD}/*.osm.pbf" on the host.

  • Run the osrm-partition logic

docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-partition /data/gcc-states-latest.osrm

  • Run the osrm-customize logic

docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-customize /data/gcc-states-latest.osrm

  • Now run the server

docker run -t -i -p 5000:5000 -v "${PWD}:/data" osrm/osrm-backend osrm-routed --algorithm mld /data/gcc-states-latest.osrm

Voila! You're done. Now you can test out the server running on port 5000

curl "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"

Sources: