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).
### Outline
[toc]
### Download OpenStreetMap extract
Download OpenStreetMap extracts for example from [Geofabrik](http://download.geofabrik.de/)
e.g.
- for Taiwan use: http://download.geofabrik.de/asia/taiwan-latest.osm.pbf
Save the OpenStreetMap extract in a folder you can access from the shared drive:
e.g. if your shared drive is `D:` place it in a folder `D:/docker`
### Used Taiwan car.lua config
Find car.lua config file in the folder `./doc` and copy it to `D:/docker`
### Install Docker on Windows
If you are using Windows 10 Pro and have Hyper-V enabled, you can install Docker for Windows. If you are using Windows 10 Home, you can install Docker Toolbox instead. Docker Toolbox uses Oracle VirtualBox instead of Hyper-V.
##### Docker Desktop for Windows 10 pro
* Download and install Docker for Windows from :https://hub.docker.com/editions/community/docker-ce-desktop-windows
<b>OR</b>
##### Docker Toolbox for Windows 10 home or Windows 7/8
* Download and install Docker Toolbox from https://github.com/docker-archive/toolbox/releases
* Click Docker Quickstart Terminal to start the Docker terminal
* Open Oracle VM VirtualBox
* Open configuration of the default virtual machine and go to shared folders
* Modify or create a new shared folder by clicking on buttons to the right. Set options to: `D:\docker` and `docker` ,then click Auto mount and Permanent configuration.
* Shutdown the default virtual machine then restart it.
* mount the shared folder by running the following command in the Docker terminal:
`sudo mount -t vboxsf -o uid=1000,gid=50 docker /docker`
### Pull the image
docker pull osrm/osrm-backend
### Pre-process extract
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
docker run -t -v d:/docker:/data osrm/osrm-backend osrm-extract -p /data/**PROFILE**.lua /data/**CITY**-latest.osm.pbf
*So for car rides in Taiwan use:*
docker run -t -v d:/docker:/data osrm/osrm-backend osrm-extract -p /data/car.lua /data/taiwan-latest.osm.pbf
- If you use Docker Toolbox, replace `d:/docker` with `/docker`
Then run (used CH algorithm ):
docker run -t -v d:/docker:/data osrm/osrm-backend osrm-contract /data/taiwan-latest.osm
- If you use Docker Toolbox, replace `d:/docker` with `/docker`
<b>OR</b>
Then run (used MLD algorithm ):
docker run -t -v d:/docker:/data osrm/osrm-backend osrm-partition /data/taiwan-latest.osrm
docker run -t -v d:/docker:/data osrm/osrm-backend osrm-customize /data/taiwan-latest.osrm
- If you use Docker Toolbox, replace `d:/docker` with `/docker`
### Start the Routing Engine
If you use CH algorithm :
docker run -t -i -p 5000:5000 -v d:/docker:/data osrm/osrm-backend osrm-routed --max-table-size=1000 /data/taiwan-latest.osrm
- If you use Docker Toolbox, replace `d:/docker` with `/docker`
If you use MLD algorithm :
docker run --name osrm -t -i -p 5000:5000 -v d:/docker:/data osrm/osrm-backend osrm-routed --algorithm mld --max-table-size=1000 /data/taiwan-latest.osrm
- If you use Docker Toolbox, replace `d:/docker` with `/docker`
Then the docker container should be running on http://127.0.0.1:5000/
IF you use Docker Toolbox, you can find the IP address of the docker machine by running:
docker-machine ip
Then the docker container should be running on http://**DOCKER_MACHINE_IP**:5000/
### Test the Routing Engine
Test request:
http://localhost:5000/route/v1/driving/121.5751292,25.0690308;121.650032,25.077068
<b>Good luck!</b>
### Reference
* How to set up your own OSRM backend with Docker on Windows
https://gist.github.com/AlexandraKapp/e0eee2beacc93e765113aff43ec77789
* docker-toolbox
https://github.com/docker-archive/toolbox/releases
* 如何在 Windows 10 家用版上安裝並使用 Docker Toolbox
https://hackmd.io/@titangene/docker-collection/%2FDKXOJpVfS0Co-o5F9SCMSQ?type=book
* Mounting Docker volumes with Docker Toolbox for Windows
https://headsigned.com/posts/mounting-docker-volumes-with-docker-toolbox-for-windows/
* github copilot (translate to english)
https://github.com/features/copilot