Wompose Labels Reference
Wompose uses special labels in Docker Compose files to customize Kubernetes resource generation. Add these labels to your service definitions to control service types, volumes, autoscaling, and more.
wompose.service.typeService typenodeport, clusterip, loadbalancer, headlessSpecifies the Kubernetes Service type. Use "loadbalancer" for external access, "nodeport" for node-level access, "clusterip" for internal-only access, or "headless" for StatefulSet DNS discovery.
wompose.service.exposeCreate Ingress/Routetrue, domain.comCreates an Ingress resource to expose the service externally. Set to "true" for auto-generated hostname, or specify a domain name like "api.example.com". Multiple domains can be comma-separated.
wompose.service.expose.tls-secretTLS secret for Ingressmy-tls-secretSpecifies the Kubernetes Secret containing TLS certificate and key for HTTPS. The secret must exist in the same namespace and contain "tls.crt" and "tls.key" data.
wompose.service.expose.ingress-class-nameIngress classnginx, traefikSpecifies which Ingress controller should handle this Ingress resource. Common values include "nginx", "traefik", "haproxy", or cloud-specific controllers.
wompose.service.nodeport.portNodePort port number30000-32767Specifies a fixed NodePort number. Must be in the range 30000-32767. If not specified, Kubernetes will auto-assign a port.
wompose.controller.typeController typedeployment, daemonset, replicationcontroller, statefulsetSpecifies the workload controller type. Use "deployment" for stateless apps, "daemonset" for node-level services, "statefulset" for stateful apps requiring stable network identity and storage.
wompose.image-pull-policyImage pull policyAlways, IfNotPresent, NeverControls when Kubernetes pulls the container image. "Always" pulls on every restart, "IfNotPresent" only pulls if not cached locally, "Never" uses only local images.
wompose.image-pull-secretImage pull secretmy-registry-secretSpecifies the Secret containing credentials for pulling images from private registries. The secret must be of type kubernetes.io/dockerconfigjson.
wompose.volume.sizePVC storage size1Gi, 10Gi, 100GiSpecifies the storage capacity for PersistentVolumeClaim. Use standard Kubernetes resource quantities like "1Gi", "500Mi", "10Gi".
wompose.volume.storage-class-nameStorageClass namestandard, fast-ssd, gp2Specifies the StorageClass for dynamic volume provisioning. Common values depend on your cluster: "standard", "premium-rwo", "gp2" (AWS), "pd-ssd" (GCP).
wompose.volume.typeVolume typepersistentVolumeClaim, emptyDir, hostPath, configMapSpecifies how volumes are provisioned. "persistentVolumeClaim" for persistent storage, "emptyDir" for temporary storage, "hostPath" for node filesystem, "configMap" for configuration data.
wompose.volume.subpathVolume subpathdata, configMounts a specific subdirectory from the volume instead of the root. Useful when sharing a volume between multiple containers or mounting specific files.
wompose.hpa.cpuHPA CPU threshold (%)50, 80Creates a HorizontalPodAutoscaler that scales pods when average CPU utilization exceeds this percentage. Requires metrics-server in the cluster.
wompose.hpa.memoryHPA memory threshold200Mi, 1GiCreates a HorizontalPodAutoscaler that scales pods when average memory usage exceeds this value. Requires metrics-server in the cluster.
wompose.hpa.replicas.minHPA min replicas1, 2, 3Minimum number of pod replicas the HPA will maintain. The autoscaler will never scale below this number.
wompose.hpa.replicas.maxHPA max replicas5, 10, 20Maximum number of pod replicas the HPA can scale to. Set based on your resource capacity and cost constraints.
wompose.cronjob.scheduleCronJob schedule*/5 * * * *, 0 2 * * *Cron expression for scheduling jobs. Format: "minute hour day month weekday". Examples: "*/5 * * * *" (every 5 min), "0 2 * * *" (daily at 2am).
wompose.cronjob.concurrency_policyCronJob concurrencyAllow, Forbid, ReplaceControls concurrent job execution. "Allow" permits overlapping jobs, "Forbid" skips new jobs if previous is running, "Replace" cancels current job and starts new one.
wompose.cronjob.backoff_limitCronJob retry limit3, 6Number of retries before marking a job as failed. Each retry uses exponential backoff delay.
wompose.security-context.fsgroupFilesystem group ID1000, 1001Sets the group ID for volume ownership. All files created in volumes will be owned by this group. Important for shared storage access.
wompose.service.groupService groupfrontend, backendGroups multiple services into a single Pod as sidecar containers. Services with the same group label will be deployed together.
wompose.init.containers.nameInit container nameinit-db, wait-for-redisAdds an init container that runs before the main container. Use for setup tasks like database migrations, waiting for dependencies, or downloading configs.
wompose.init.containers.imageInit container imagebusybox, alpineDocker image for the init container. Typically lightweight images like busybox or alpine for simple setup scripts.
wompose.init.containers.commandInit container command["sh", "-c", "echo hello"]Command to run in the init container. JSON array format. The main container starts only after all init containers complete successfully.
Examples
Web App with LoadBalancer
Expose a web application externally using a LoadBalancer service
services:
web:
image: nginx:latest
ports:
- "80:80"
labels:
wompose.service.type: loadbalancerDatabase with Persistent Storage
PostgreSQL with persistent volume and custom storage class
services:
db:
image: postgres:15
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: secret
volumes:
- db-data:/var/lib/postgresql/data
labels:
wompose.volume.size: 10Gi
wompose.volume.storage-class-name: fast-ssd
volumes:
db-data:Auto-scaling API Service
API with horizontal pod autoscaler based on CPU usage
services:
api:
image: myapi:latest
ports:
- "8080:8080"
deploy:
replicas: 2
labels:
wompose.hpa.cpu: 70
wompose.hpa.replicas.min: 2
wompose.hpa.replicas.max: 10Service with Ingress
Expose service via Ingress with TLS termination
services:
frontend:
image: frontend:latest
ports:
- "3000:3000"
labels:
wompose.service.expose: api.example.com
wompose.service.expose.tls-secret: tls-cert
wompose.service.expose.ingress-class-name: nginxScheduled Backup Job
CronJob that runs daily at 2am
services:
backup:
image: backup-tool:latest
restart: "no"
labels:
wompose.cronjob.schedule: "0 2 * * *"
wompose.cronjob.concurrency_policy: Forbid
wompose.cronjob.backoff_limit: 3DaemonSet for Logging
Deploy a log collector on every node
services:
fluentd:
image: fluentd:latest
volumes:
- /var/log:/var/log:ro
labels:
wompose.controller.type: daemonset
wompose.volume.type: hostPath