This example demonstrates how to build OneBusAway bundles using local GTFS files instead of downloading them from a URL.
- A local GTFS zip file
- Docker and Docker Compose installed on your system
Copy your GTFS zip file to this directory:
cp /path/to/your/gtfs.zip ./sta-gtfs-may-2025.zipOr update the Dockerfile and docker-compose.yml to use your filename.
# build the bundle
docker compose up oba_bundler
# Then start the app
docker compose up oba_appThis will:
- Build a bundle from your local GTFS file
- Start the database (PostgreSQL or MySQL)
- Start the OneBusAway API server
Access the API at: http://localhost:8080/onebusaway-api-webapp/api/where/agencies-with-coverage.json?key=test
First, build the base OneBusAway image from the parent directory:
cd ..
docker build -t oba-base:latest -f oba/Dockerfile .Copy your GTFS zip file to this directory and rename it, or update the Dockerfile to use your filename:
cp /path/to/your/gtfs.zip ./your-gtfs-file.zipEdit the Dockerfile to use your GTFS filename:
- Change
your-gtfs-file.zipto match your actual filename in both the COPY and ENV lines
docker build -t oba-local-gtfs:latest .docker run --rm -v $(pwd)/../bundle:/bundle oba-local-gtfs:latestThis will:
- Use your local GTFS file (no download required)
- Run gtfstidy to optimize the GTFS data
- Build the OneBusAway bundle
- Output the bundle to the shared volume
You can override these environment variables in the Dockerfile or docker-compose.yml:
GTFS_ZIP_FILENAME: The name of your GTFS file (required when not using GTFS_URL)TZ: Timezone for the transit agency (default: America/New_York)GTFS_TIDY_ARGS: Arguments for gtfstidy optimization (default: OscRCSmeD)OBA_VERSION: OneBusAway version (inherited from base image)
oba_database: MySQL database (optional)oba_database_pg: PostgreSQL database (default)oba_bundler: Builds transit data bundle from local GTFSoba_app: OneBusAway API server
- Build Time: Your GTFS zip file is copied into the Docker image at
/tmp/ - Runtime: The
docker-entrypoint.shscript:- Finds your GTFS file in
/tmp/ - Copies it to
/bundle/gtfs.zip(after the volume is mounted) - Executes the main command (build_bundle.sh or supervisord)
- Finds your GTFS file in
This approach is needed because Docker volume mounts happen after the image is built but before commands run. By copying to /tmp/ first, we ensure the file isn't hidden by the volume mount.
- Place any GTFS zip file in this directory - it will be automatically detected
- Make sure not to set GTFS_URL when using GTFS_ZIP_FILENAME
- The bundle output will be in the ../bundle directory
- The docker-compose file uses PostgreSQL by default; comment it out and uncomment MySQL if preferred
- You can override the GTFS filename by setting
GTFS_ZIP_FILENAMEin docker-compose.yml