- https://github.com/valhalla/valhalla/blob/3.4.0/Dockerfile
- ghcr.io/gis-ops/docker-valhalla/valhalla:latest
- https://download.geofabrik.de/north-america/canada.html
Docker image (docker-valhalla/valhalla) requires root privileged permission which sterms from non-existing user_id on host machine. It attempts to use sudo chmod
overwriting file premission in the mounted path. A simpler solution is to create user_id, group_id
on host and set proper folder permission to the path so that docker user_id is matched with host user_id of the mounted folder.
This repo is to implement non-root user so that the container can be deployed in Azure Container App and kubernetes.
#
docker run --rm -p 8002:8002 \
-v $PWD/gtfs_feeds:/gtfs_feeds \
-e build_transit=True -e tile_urls=https://download.geofabrik.de/north-america/canada/ontario-latest.osm.pbf --name valhalla-local ghcr.io/gis-ops/docker-valhalla/valhalla
docker build . -f Dockerfile.local --tag valhalla-local
# docker tag valhalla-local "phamidko/valhalla:latest"
# docker push "phamidko/valhalla:latest"
docker run -dt -p 8002:8002 -e tile_urls=https://download.geofabrik.de/north-america/canada/ontario-latest.osm.pbf --name valhalla-local valhalla-local
docker logs -f valhalla-local
curl http://localhost:8002/route \
--data '{"locations":[
{"lat":41.318818,"lon":19.461336},
{"lat":41.321001,"lon":19.459598}
],
"costing":"auto"
}' | jq '.'
docker exec -it valhalla-local bash
In docker-compose.yml
, modify the region pbf varible to compute different region tiles
docker compose build valhalla
docker run -dt --rm -p 8002:8002 --name valhalla-bundle valhalla-bundle
docker tag valhalla-bundle "phamidko/valhalla-bundle-ontario:latest"
docker push "phamidko/valhalla-bundle-ontario:latest"
- first, download GTFS zip file from remtoe link and unzip the file GRT Open Data
- Mount the folder to docker run cmd Build Valhalla with transit
cd /home/phamid/upwork-repos/upwork-valhala
mkdir -p gtfs_feeds/grt_ontario
wget -O gtfs_feeds/grt_ontario/GRT_GTFS.zip https://www.regionofwaterloo.ca/opendatadownloads/GRT_GTFS.zip
unzip gtfs_feeds/grt_ontario/GRT_GTFS.zip -d gtfs_feeds/grt_ontario/
docker run -dt --rm -v ./gtfs_feeds:/gtfs_feeds -p 8002:8002 --name valhalla-bundle valhalla-bundle
docker exec -it valhalla-bundle /bin/bash
curl http://localhost:8002/route \
--data '{"locations":[
{"lat":43.47936690284358,"lon": -80.51799122219329},
{"lat":43.47239517859761,"lon":-80.59289294228155}
],
"costing":"multimodal"
}' | jq '.'
Purpose: Copy gtfs folder into the image so that there is no dependency in Azure Container App
docker compose build valhalla-transit --progress plain --no-cache
# check the contents
docker run -dt --rm -p 8002:8002 --name valhalla-transit-bundle valhalla-transit-bundle:latest
docker exec -it valhalla-transit-bundle bash
ls /gtfs_feeds
docker tag valhalla-transit-bundle "phamidko/valhalla-transit-bundle:latest"
docker push "phamidko/valhalla-transit-bundle:latest"
- Define
tile_urls
environment for region pbf url link(s) - Set port binding to 8002
[20240524]
mkdir gtfs_feeds/GO-GTFS
wget -O gtfs_feeds/GO-GTFS/GO-GTFS.zip https://assets.metrolinx.com/raw/upload/Documents/Metrolinx/Open%20Data/GO-GTFS.zip
unzip gtfs_feeds/GO-GTFS/GO-GTFS.zip -d gtfs_feeds/GO-GTFS
docker run --rm -p 8002:8002 \
-v $PWD/gtfs_feeds:/gtfs_feeds \
-e build_transit=True -e tile_urls=https://download.geofabrik.de/north-america/canada/ontario-latest.osm.pbf --name valhalla-local ghcr.io/gis-ops/docker-valhalla/valhalla
mkdir gtfs_feeds/guelph
wget -O gtfs_feeds/guelph/guelph_transit_gtfs.zip http://data.open.guelph.ca/datafiles/guelph-transit/guelph_transit_gtfs.zip
unzip gtfs_feeds/guelph/guelph_transit_gtfs.zip -d gtfs_feeds/guelph
docker run --rm -p 8002:8002 \
-v $PWD/gtfs_feeds:/gtfs_feeds \
-e build_transit=True -e tile_urls=https://download.geofabrik.de/north-america/canada/ontario-latest.osm.pbf --name valhalla-local ghcr.io/gis-ops/docker-valhalla/valhalla 2>&1 | tee build.log