Supported Versions
When importing a Docker service, use version format:docker@27
Why VMs?
While Zerops primarily uses native Linux containers for optimal performance, this VM-based approach allows you to run virtually any Docker container while maintaining Zerops’ robust infrastructure management. You can learn more about differences between Containers and Virtual Machines in Zerops.Important Considerations
Before using Docker services, consider these important aspects:Virtual Machine Environment
Docker services in Zerops operate in a full VM environment, which has several implications:- Slower Boot Times: VMs require more time to initialize due to full kernel boot
- Higher Resource Usage: VMs include additional system overhead compared to native containers
- Scaling Limitations:
- Vertical scaling requires VM restart
- Resources must be set as fixed values (no min-max ranges)
- Zerops automatically restarts the VM when resource values are changed in UI
- Storage Management: Disk space can only be increased, not decreased without recreation
- Build Phase Limitations: Build phase runs in containers, not in the VM environment
Advantages
Despite these limitations, Docker services offer some benefits:- Broad Compatibility: Run almost any Docker container with minimal modification
- Familiar Environment: Standard Docker runtime environment
Configuration Guide
Basic Structure
Docker services in Zerops are configured through thezerops.yaml file. Here’s a typical configuration pattern:
zerops.yaml
We are actively working on improving the speed of image caching after
run.prepareCommands and reducing the startup time of runtime VMs. These improvements will be released in future updates.Network Configuration
Docker services require the--network=host flag for proper integration with Zerops:
- Direct Port Management: Ports are managed through
zerops.yaml - Simplified Configuration: Avoids double port exposure in Docker and Zerops
- Native Performance: Direct access to host networking
Environment Variables
When using Docker services, there’s an additional layer to consider since environment variables defined in Zerops must be explicitly passed to your Docker containers.1. Defining Variables in Zerops
Define your environment variables in therun.envVariables section of your zerops.yaml:
zerops.yaml
2. Passing Variables to Docker Containers
For single containers, pass variables using the-e flag:
zerops.yaml
docker-compose.yaml:
docker-compose.yaml
Docker Compose Support
For projects using Docker Compose, additional configuration is required:1. File Deployment
zerops.yaml
2. Network Mode
docker-compose.yaml
3. Start Command
zerops.yaml
Implementation Examples
Single Container
zerops.yaml
Single Service with Docker Compose
zerops.yaml
Multiple Services with Docker Compose
zerops.yaml
Scaling Operations
Docker services in Zerops have specific scaling characteristics:Vertical Scaling
- Resources must be defined with fixed values instead of min-max ranges
- CPU, RAM, and disk are specified as single values:
- Any change to these values through the UI triggers an automatic VM restart
- Plan your resource allocation carefully to minimize scaling operations
Horizontal Scaling
- Still supports multiple containers through
minContainersandmaxContainers - Consider breaking large services into smaller components
- Implement proper health checks for reliable scaling
- Use horizontal scaling when possible to avoid VM restarts
Best Practices
Image Management
- Always use specific version tags instead of
:latestto prevent caching issues - Keep images small to reduce deployment time
- Use multi-stage builds for optimized images
Resource Planning
- Account for VM overhead in resource allocation
- Plan for longer initialization times
- Consider the impact on scaling operations
Migration Consideration
- Evaluate if your workload could run on native containers
- Consider gradual migration for complex applications
- Balance development effort against operational benefits
Limitations and Workarounds
Build Phase
Since the build phase runs in containers rather than VMs:- Use
run.prepareCommandsfor Docker-specific build steps - Consider external CI/CD for complex Docker builds
- Leverage pre-built images when possible
Support
For advanced configurations or custom requirements:- Join our Discord community
- Contact support via email