$linuxjunkies
>

kompose(1)

Kompose translates Docker Compose files into Kubernetes manifests.

UbuntuDebianFedoraArch

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

FlagWhat it does
-f, --fileSpecify the Compose file to convert (default: docker-compose.yml)
-o, --outOutput directory for generated manifests (default: current directory)
--stdoutPrint manifests to stdout instead of writing files
-d, --deployment-typeSpecify deployment type: kubernetes, openshift, podman (default: kubernetes)
--replicasSet the number of replicas for services in the output
--volumesHandle volumes in output: emptyDir, hostPath, or persistentVolumeClaim
--buildBuild images before pushing (none, local, or push)
--push-imagePush built images to registry
--log-levelSet logging level: debug, info, warn, error (default: info)
-v, --versionPrint Kompose version and exit
-h, --helpShow help message

Examples

Convert docker-compose.yml to Kubernetes manifests in the current directory

kompose convert -f docker-compose.yml

Convert 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 openshift

Convert with replica count of 3 for all services

kompose convert --replicas 3 -f docker-compose.yml

Build Docker images and push them to a registry during conversion

kompose build -f docker-compose.yml --push-image

Convert using PersistentVolumeClaims for service volumes

kompose convert -f docker-compose.yml --volumes persistentVolumeClaim

Display the installed version of Kompose

kompose version

Related commands