The OSRM docker quick start provides a great explanation on how to set up the container: https://hub.docker.com/r/osrm/osrm-backend/
Yet - for Docker on Windows minor changes were necessary for me (otherwise I'd get "File not found" or "Permission" errors).
This is how it worked for me:
docker pull osrm/osrm-backend
Download OpenStreetMap extracts for example from Geofabrik
e.g.
- for Berlin use: http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
- for Hamburg use: http://download.geofabrik.de/europe/germany/hamburg-latest.osm.pbf
- etc.
Save the OpenStreetMap extract in a folder you can access from the shared drive: e.g. if your shared drive is "C:" place it in a folder "C:/docker"
Pre-process the extract and start a routing engine HTTP server on port 5000.
Depending on what kind of routing you want to use, choose the profile accordingly:
-
car: car.lua
-
walking: foot.lua
-
bike: bicycle.lua
docker run -t -v c:/docker:/data osrm/osrm-backend osrm-extract -p /opt/PROFILE.lua /data/CITY-latest.osm.pbf
So for car rides in Berlin use:
docker run -t -v c:/docker:/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf
Then run:
docker run -t -v c:/docker:/data osrm/osrm-backend osrm-partition /data/berlin-latest.osrm
docker run -t -v c:/docker:/data osrm/osrm-backend osrm-customize /data/berlin-latest.osrm
docker run --name osrm -t -i -p 5000:5000 -v c:/docker:/data osrm/osrm-backend osrm-routed --algorithm mld /data/berlin-latest.osrm
Then the docker container should be running on http://127.0.0.1:5000/
Test request:
curl "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"
To get the engine started a second time when you pick up your work, only the last container needs to be started again. If you named it (with the flag --name osrm), you can run:
docker start osrm
Futher useful links:
- Project website: http://project-osrm.org/
- GitHub Link: https://github.com/Project-OSRM/osrm-backend
- API Documentation: http://project-osrm.org/docs/v5.5.1/api/#general-options
- Docker backend image: https://hub.docker.com/r/osrm/osrm-backend/
If anyone is here for Docker on Windows but under WSL just alter the lines. In my case e.g.:
See this explanation under "shared folders on demand".