Docker Images
Apache Pulsar provides two official Docker images:apachepulsar/pulsar- Core Pulsar components (broker, bookie, ZooKeeper)apachepulsar/pulsar-all- Includes connectors and offloaders (larger image)
Image Details
- Base: Alpine Linux 3.23
- JDK: Amazon Corretto 21
- User: Non-root user (uid 10000)
- Security: Runs as non-root by default (since 2.10.0)
Quick Start (Standalone)
Start Pulsar standalone
- Binary protocol on port 6650
- HTTP admin API on port 8080
Persistent Storage
To persist data across container restarts, mount volumes:/pulsar/data- Message data and metadata/pulsar/conf- Configuration files/pulsar/logs- Log files
Docker Compose Deployment
Standalone with Docker Compose
Createdocker-compose.yml:
Multi-Container Cluster
For a production-like cluster with separate ZooKeeper, BookKeeper, and broker containers:Environment Variables
Configure Pulsar using environment variables:PULSAR_MEM- JVM heap and direct memoryPULSAR_GC- Garbage collection settingsclusterName- Cluster nameadvertisedAddress- Advertised hostnamemetadataStoreUrl- ZooKeeper connection string
Building Custom Images
Create custom images with specific connectors or configurations:Adding Debugging Tools
For troubleshooting, create an image with additional tools:Security Considerations
Non-Root User
Pulsar Docker images run as user 10000 (non-root) by default since version 2.10.0:Running on OpenShift
For OpenShift compatibility:Debugging as Root
If you need root access for debugging:Networking
Host Network Mode
For better performance (Linux only):Custom Network
Resource Limits
Set CPU and memory limits:Monitoring
Prometheus Metrics
Expose Prometheus metrics:Log Collection
Mount log directory:Health Checks
Docker health check configuration:Backup and Recovery
Export Data
Restore Data
Troubleshooting
Container Not Starting
Check logs:Permission Denied
If you see permission errors, ensure volumes have correct ownership:Out of Memory
Adjust JVM settings:Connection Refused
Verify ports are exposed:Image Sizes
Comparison of official images (version 2.9.1):| Image | Size | Use Case |
|---|---|---|
| apachepulsar/pulsar | 1.59 GB | Standard deployment |
| apachepulsar/pulsar-all | 3.44 GB | With all connectors/offloaders |
| Custom image | ~1.6 GB | Selective connectors |
Production Considerations
Next Steps
- Deploy on Kubernetes for production
- Set up Monitoring with Prometheus and Grafana
- Configure Security with authentication and TLS
- Learn about Tiered Storage for long-term retention