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 type
Values:nodeport, clusterip, loadbalancer, headless

Specifies 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/Route
Values:true, domain.com

Creates 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 Ingress
Values:my-tls-secret

Specifies 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 class
Values:nginx, traefik

Specifies which Ingress controller should handle this Ingress resource. Common values include "nginx", "traefik", "haproxy", or cloud-specific controllers.

wompose.service.nodeport.portNodePort port number
Values:30000-32767

Specifies a fixed NodePort number. Must be in the range 30000-32767. If not specified, Kubernetes will auto-assign a port.

wompose.controller.typeController type
Values:deployment, daemonset, replicationcontroller, statefulset

Specifies 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 policy
Values:Always, IfNotPresent, Never

Controls 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 secret
Values:my-registry-secret

Specifies the Secret containing credentials for pulling images from private registries. The secret must be of type kubernetes.io/dockerconfigjson.

wompose.volume.sizePVC storage size
Values:1Gi, 10Gi, 100Gi

Specifies the storage capacity for PersistentVolumeClaim. Use standard Kubernetes resource quantities like "1Gi", "500Mi", "10Gi".

wompose.volume.storage-class-nameStorageClass name
Values:standard, fast-ssd, gp2

Specifies the StorageClass for dynamic volume provisioning. Common values depend on your cluster: "standard", "premium-rwo", "gp2" (AWS), "pd-ssd" (GCP).

wompose.volume.typeVolume type
Values:persistentVolumeClaim, emptyDir, hostPath, configMap

Specifies how volumes are provisioned. "persistentVolumeClaim" for persistent storage, "emptyDir" for temporary storage, "hostPath" for node filesystem, "configMap" for configuration data.

wompose.volume.subpathVolume subpath
Values:data, config

Mounts 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 (%)
Values:50, 80

Creates a HorizontalPodAutoscaler that scales pods when average CPU utilization exceeds this percentage. Requires metrics-server in the cluster.

wompose.hpa.memoryHPA memory threshold
Values:200Mi, 1Gi

Creates a HorizontalPodAutoscaler that scales pods when average memory usage exceeds this value. Requires metrics-server in the cluster.

wompose.hpa.replicas.minHPA min replicas
Values:1, 2, 3

Minimum number of pod replicas the HPA will maintain. The autoscaler will never scale below this number.

wompose.hpa.replicas.maxHPA max replicas
Values:5, 10, 20

Maximum number of pod replicas the HPA can scale to. Set based on your resource capacity and cost constraints.

wompose.cronjob.scheduleCronJob schedule
Values:*/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 concurrency
Values:Allow, Forbid, Replace

Controls 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 limit
Values:3, 6

Number of retries before marking a job as failed. Each retry uses exponential backoff delay.

wompose.security-context.fsgroupFilesystem group ID
Values:1000, 1001

Sets 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 group
Values:frontend, backend

Groups multiple services into a single Pod as sidecar containers. Services with the same group label will be deployed together.

wompose.init.containers.nameInit container name
Values:init-db, wait-for-redis

Adds 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 image
Values:busybox, alpine

Docker image for the init container. Typically lightweight images like busybox or alpine for simple setup scripts.

wompose.init.containers.commandInit container command
Values:["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: loadbalancer

Database 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: 10

Service 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: nginx

Scheduled 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: 3

DaemonSet 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