Running OSRM with Docker
Andrew B. Collier
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:
Build the image.
$ docker build -t osrm:latest .
Download map data. For the sake of illustration, we’ll assume that the resulting file is called
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 and submit requests!