Getting started on macOS with Docker - HY-OHTUPROJ-OSRM/osrm-project GitHub Wiki
These step‑by‑step notes assume Docker Desktop for macOS is installed and running. All commands can be copied verbatim ➜ paste into Terminal.app.
Example folder legend
~/ohtu/osrm-demo ├── routing-api/ │ ├── buildmac.sh │ ├── startmac.sh │ ├── create_database.sh │ ├── ... │ └── osrm-backend/ │ └── docker/ │ └── Dockerfile-debian └── routing-front/ ├── buildmac.sh ├── ... └── startmac.sh
# Feel free to choose another location
mkdir -p ~/ohtu/osrm-demo
cd ~/ohtu/osrm-demo
docker run --platform linux/amd64 \
-p 5432:5432 \
-e POSTGRES_PASSWORD=pass \
--name postgis \
-d postgis/postgis
- Argument
--platform linux/amd64
tells Docker to fetch the Intel/AMD 64-bit build of the image—even on Apple Silicon (arm64). Docker Desktop uses QEMU under the hood to emulate x86-64 if your Mac’s CPU is arm64 - Container name : postgis
- DB connection :
postgres
▸localhost:5432
▸ passwordpass
# still inside ~/ohtu/osrm-demo
git clone https://github.com/HY-OHTUPROJ-OSRM/routing-api.git
cd routing-api
cd osrm-backend
git submodule init
git submodule update
# build the Debian‑based OSRM image (~v6.0.0)
docker build -f docker/Dockerfile-debian \
-t osrm-backend:v6.0.0-debian .
cd .. # back to routing-api/
./buildmac.sh
cd ~/ohtu/osrm-demo # <- back to project root
git clone https://github.com/HY-OHTUPROJ-OSRM/routing-front.git
cd routing-front
git checkout dev
./buildmac.sh
Open two terminal tabs:
cd ~/ohtu/osrm-demo/routing-api
./startmac.sh
cd ~/ohtu/osrm-demo/routing-front
./startmac.sh
Both scripts print the local URL (e.g. http://localhost:3000
for the API, http://localhost:8080
for the UI).
Symptom | Quick check | Fix |
---|---|---|
Port 5432 busy / DB won’t start | sudo lsof -iTCP:5432 -sTCP:LISTEN |
Stop the blocking service: • docker ps --filter "publish=5432" look for NAMES • docker rm <NAME>
|
API can’t connect to database |
docker logs postgis (look for "database system is ready to accept connections") |
Verify DATABASE_HOST / PORT / USER / PASSWORD / DB in your environment and in routing-api/startmac.sh . |
Front page 404 / blank | tail -f routing-front/logs/* |
Check for Webpack / Vite build errors, then rerun front's ./buildmac.sh and ./startmac.sh . |
✅ Done! Open the front‑end URL, search for a route, and watch the API query your freshly‑loaded PostGIS + OSRM backend.