kompose(1)
Kompose translates Docker Compose files into Kubernetes manifests.
Synopsis
kompose [GLOBAL FLAGS] COMMAND [FLAGS] [ARGUMENTS]Description
Kompose is a conversion tool that takes a Docker Compose file as input and outputs Kubernetes manifests (YAML files). It simplifies the process of moving containerized applications from Docker Compose to Kubernetes by automatically generating Services, Deployments, StatefulSets, and other Kubernetes resources.
Kompose supports Docker Compose v1, v2, and v3 formats. It intelligently maps Compose services to Kubernetes primitives, handling volumes, ports, environment variables, and health checks. The generated manifests can be directly applied to a Kubernetes cluster or further customized as needed.
Common options
| Flag | What it does |
|---|---|
-f, --file | Specify the Compose file to convert (default: docker-compose.yml) |
-o, --out | Output directory for generated manifests (default: current directory) |
--stdout | Print manifests to stdout instead of writing files |
-d, --deployment-type | Specify deployment type: kubernetes, openshift, podman (default: kubernetes) |
--replicas | Set the number of replicas for services in the output |
--volumes | Handle volumes in output: emptyDir, hostPath, or persistentVolumeClaim |
--build | Build images before pushing (none, local, or push) |
--push-image | Push built images to registry |
--log-level | Set logging level: debug, info, warn, error (default: info) |
-v, --version | Print Kompose version and exit |
-h, --help | Show help message |
Examples
Convert docker-compose.yml to Kubernetes manifests in the current directory
kompose convert -f docker-compose.ymlConvert and save Kubernetes manifests to the k8s/ directory
kompose convert -f docker-compose.yml -o k8s/Convert and directly apply the manifests to a Kubernetes cluster
kompose convert -f docker-compose.yml --stdout | kubectl apply -f -Convert for OpenShift, generating OpenShift-compatible resources
kompose convert -f docker-compose.yml --deployment-type openshiftConvert with replica count of 3 for all services
kompose convert --replicas 3 -f docker-compose.ymlBuild Docker images and push them to a registry during conversion
kompose build -f docker-compose.yml --push-imageConvert using PersistentVolumeClaims for service volumes
kompose convert -f docker-compose.yml --volumes persistentVolumeClaimDisplay the installed version of Kompose
kompose version