Docker Recipes - Project-OSRM/osrm-backend GitHub Wiki

We publish ready to use lightweight Docker images based on Alpine Linux for each OSRM release:

https://github.com/Project-OSRM/osrm-backend/pkgs/container/osrm-backend

They can be used via

wget http://download.geofabrik.de/europe/monaco-latest.osm.pbf
#The next line is required, otherwise the very old docker image from https://hub.docker.com/r/osrm/osrm-backend is used
docker pull ghcr.io/project-osrm/osrm-backend:latest
docker run -t -v $(pwd):/data osrm/osrm-backend:vX.Y.Z osrm-extract -p /opt/car.lua /data/monaco-latest.osm.pbf
[ $? -eq 0 ] && echo "Extract command was successful" || echo "Extract failed"
docker run -t -v $(pwd):/data osrm/osrm-backend:vX.Y.Z osrm-contract /data/monaco-latest.osrm
[ $? -eq 0 ] && echo "Contract command was successful" || echo "Contract failed"
docker run -t -i -p 5000:5000 -v $(pwd):/data osrm/osrm-backend:vX.Y.Z osrm-routed /data/monaco-latest.osrm

curl 'http://localhost:5000/route/v1/driving/7.436828612,43.739228054975506;7.417058944702148,43.73284046244549?steps=true'

Replace X.Y.Z with the latest stable OSRM image tag you want to run.

Check the published tags here.

You can now hook up a frontend, for this see:

https://github.com/Project-OSRM/osrm-frontend

These images are created via utilities here:

https://github.com/Project-OSRM/osrm-backend-docker

Note on STXXL usage

If you're processing big files, you may want to customize the STXXL configuration. In this case, the easiest thing to do is put the .stxxl configuration file in the same location as your .osm.pbf files - these get mounted in /data inside the container, and the working directory is set to that location when the container starts - the .stxxl file will be automatically read and used.