Docker Setup Guide¶
This guide shows how to run the DTA Provenance Demo using Docker containers.
Quick Start¶
Option 1: Docker Compose (Recommended)¶
Start all services with one command:
This starts: - Git-native: Provenance tracking CLI - Blockchain: Hardhat local blockchain node - Jupyter: Interactive notebook server
Access services: - Jupyter Notebook: http://localhost:8888 - Blockchain RPC: http://localhost:8545
Stop all services:
Option 2: Individual Containers¶
Git-Native Container¶
Build:
Run:
# Help
docker run dta-provenance:git-native
# Validate a file
docker run -v $(pwd)/standards/examples:/data \
dta-provenance:git-native \
dta-provenance validate /data/healthcare-imaging.json
# Interactive shell
docker run -it --entrypoint /bin/bash dta-provenance:git-native
Blockchain Container¶
Build:
Run:
# Start local blockchain node
docker run -p 8545:8545 dta-provenance:blockchain
# Run tests
docker run dta-provenance:blockchain npx hardhat test
# Interactive shell
docker run -it --entrypoint /bin/bash dta-provenance:blockchain
Common Tasks¶
Run Tests¶
# Git-native tests
docker-compose exec git-native pytest -v
# Blockchain tests
docker-compose exec blockchain npx hardhat test
# Run all tests
docker-compose exec git-native pytest && \
docker-compose exec blockchain npx hardhat test
Validate DTA Examples¶
# Validate all examples
for file in standards/examples/*.json; do
docker-compose exec git-native dta-provenance validate "$file"
done
Use CLI Tools¶
# Git-native CLI
docker-compose exec git-native dta-provenance --help
docker-compose exec git-native dta-provenance validate /app/standards/examples/healthcare-imaging.json
# Blockchain deployment
docker-compose exec blockchain npx hardhat run scripts/deploy.js --network localhost
Interactive Development¶
# Git-native shell
docker-compose exec git-native /bin/bash
# Blockchain shell
docker-compose exec blockchain /bin/bash
# Python REPL with provenance modules
docker-compose exec git-native python
>>> from src.provenance import ProvenanceMetadata
>>> # ... your code here
Jupyter Notebook¶
Access the interactive demo:
-
Start Jupyter:
-
Open http://localhost:8888 in your browser
-
Open
DTA_Provenance_Demo.ipynb
Volume Persistence¶
Docker volumes preserve data across container restarts:
git-data: Git repositories and datablockchain-data: Blockchain cache and artifactsjupyter-data: Jupyter configuration
View volumes:
Clean up volumes:
Troubleshooting¶
Port Already in Use¶
If ports 8545 or 8888 are already in use, modify docker-compose.yml:
Permission Issues¶
If you encounter permission issues with volumes:
Rebuild Containers¶
Force rebuild after code changes:
View Logs¶
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f git-native
docker-compose logs -f blockchain
docker-compose logs -f jupyter
Production Deployment¶
For production use, consider:
- Security:
- Use proper authentication for Jupyter
- Secure blockchain RPC endpoints
-
Run containers as non-root user
-
Networking:
- Use reverse proxy (nginx, Traefik)
- Enable TLS/SSL
-
Restrict network access
-
Resource Limits:
-
Environment Variables:
- Use
.envfile for sensitive data -
Never commit secrets to Git
-
Monitoring:
- Add health checks
- Use logging aggregation
- Monitor resource usage
Multi-Architecture Support¶
Build for multiple architectures (ARM64, AMD64):
# Enable Docker buildx
docker buildx create --use
# Build multi-arch images
docker buildx build --platform linux/amd64,linux/arm64 \
-f Dockerfile.git-native \
-t dta-provenance:git-native \
--push .
CI/CD Integration¶
Example GitHub Actions workflow:
- name: Build and test Docker images
run: |
docker-compose build
docker-compose up -d
docker-compose exec -T git-native pytest
docker-compose exec -T blockchain npx hardhat test
docker-compose down
Additional Resources¶
Need help? Open an issue on GitHub or check the main README.md