Running OSRM with Docker

I’ve now been through the process of setting up OSRM a few times. While it’s not exactly taxing, it seemed like a prime candidate for automation.

Although there are existing Docker images for OSRM, I elected to roll my own to have a little more control. You can find the Dockerfile and a startup script here.

To use, do as follows:

  1. Build the image.
$ docker build -t osrm:latest .
  1. Download map data. For the sake of illustration, we’ll assume that the resulting file is called map.xml.
  2. Launch a container.
$ docker run -p 5000:5000 -v `pwd`:/data osrm:latest map.xml

The image exposes the service on port 5000, which is mapped to port 5000 on the host. Now go ahead an submit requests!

Categorically Variable