Why Alpine?
Alpine Linux is ideal when you need:- Minimal Resource Footprint - Smaller image sizes and lower memory usage
- Security Focus - Reduced attack surface with minimal packages
- Fast Boot Times - Lightweight design enables quicker container startup
- Efficient Scaling - Less overhead means more instances per host
Getting Started
Alpine services give you a minimal foundation to build upon. You can:- Install packages using the
apkpackage manager - Configure custom runtime environments
- Run applications in languages not natively supported by Zerops
- Create resource-efficient containerized applications
Creating an Alpine Service
You can create an Alpine service using:- Zerops GUI - Through the web interface when adding a new service
- zCLI - Using the command-line interface
Configuration Example
Build and Runtime Configuration
Customize Build Environment
Use the build phase to install dependencies and prepare your application:Customize Runtime Environment
Configure how your application runs:Package Management
Alpine uses theapk package manager. Common commands:
Scaling Configuration
Alpine services support both horizontal and vertical scaling:Use Cases
Alpine services are ideal for:- Microservices - Lightweight containers for service-oriented architectures
- API Services - Minimal overhead for high-performance APIs
- CLI Tools - Small container images for utility applications
- Edge Computing - Resource-constrained environments
- Cost Optimization - Lower resource usage reduces hosting costs
Common Patterns
Installing Build Dependencies
Node.js Application
Python Application
Go Application
Alpine vs Ubuntu
| Feature | Alpine | Ubuntu |
|---|---|---|
| Image Size | ~5-7 MB base | ~30-40 MB base |
| Package Manager | apk | apt |
| C Library | musl libc | glibc |
| Package Availability | Smaller repository | Larger repository |
| Resource Usage | Lower | Higher |
| Boot Time | Faster | Slower |
Some applications compiled for glibc may require modifications to run on Alpine’s musl libc. Test thoroughly when migrating from Ubuntu to Alpine.
Best Practices
Performance
- Use multi-stage builds to keep final images small
- Install only necessary runtime packages
- Use
--no-cacheflag withapk addto avoid caching - Remove build dependencies after compilation
Security
- Keep packages updated with
apk update && apk upgrade - Remove unnecessary packages
- Use specific version tags for reproducible builds
- Run applications as non-root user when possible
Maintainability
- Document all installed packages and their purpose
- Pin package versions for stability
- Test compatibility with musl libc
- Keep build and runtime configurations separate
Troubleshooting
Missing Packages
If a package is not available in Alpine repositories:- Search the Alpine package database
- Check if it’s in a different repository (edge, community)
- Consider building from source
- Use a Ubuntu service if the package is critical
musl libc Compatibility
Some pre-compiled binaries expect glibc. Solutions:- Find an Alpine-compatible version
- Compile from source on Alpine
- Use a compatibility layer (not recommended)
- Switch to Ubuntu service if necessary
Popular Guides
- zCLI - Command-line tool for managing Zerops services
- Zerops VPN - Securely connect to your services
- Environment Variables - Configure your application
- Scaling - Optimize resource usage
Support
Need help getting started with Alpine services?- Join our Discord community - Get help from our team and other members
- Check the documentation for specific how-to guides
- Share your knowledge and help others in the community