How to Turn Kubernetes Manifests into a docker-compose.yml
Add your Kubernetes manifests
Start with the Kubernetes manifests you already have: Deployments, Services, StatefulSets, Jobs or plain Pods.
---, the output of kubectl get deploy,svc -o yaml, or a rendered Helm chart.Example: a Deployment and its Service
apiVersion: apps/v1
kind: Deployment
metadata:
name: web-app
spec:
replicas: 1
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: nginx
image: nginx:1.27
ports:
- containerPort: 80
env:
- name: SITE_ID
value: "00501"
---
apiVersion: v1
kind: Service
metadata:
name: web-app
spec:
selector:
app: web
ports:
- port: 8080
targetPort: 80Read the compose file
Each container gets its own Docker Compose service. This is what carries over:
command as entrypoint, args as command, and workingDir.Probes, init containers, node selectors, Ingress, HPAs and ConfigMap or Secret volumes have no direct Compose equivalent. They are not dropped silently: each one is named in a comment at the top of the output.
Check and run it
The example from Step 1 comes out like this. The Service publishes 8080 on your machine and sends it to port 80 in the container, and SITE_ID keeps its leading zeros:
services:
web-app:
image: nginx:1.27
environment:
SITE_ID: "00501"
ports:
- "8080:80"
restart: alwaysdocker compose config prints the file the way Docker reads it, which catches mistakes before anything starts.docker compose up -d, then docker compose logs -f to follow the output.docker compose down; add -v to remove the named volumes too.Going the other way? Docker Compose to Kubernetes builds Deployments and Services from a compose file, and Helm to Kubernetes renders a chart into manifests you can paste here.
Frequently Asked Questions
Why convert Kubernetes manifests to Docker Compose?
Running a whole cluster on a laptop (minikube, kind, k3d) is heavy when you only want to start an app and its database to work on a bug. A compose file starts the same images with the same settings using nothing but Docker. Treat the result as a starting point for local work, not a copy of production: there is no scheduler, no probes and no Ingress.
Which Kubernetes resources are converted?
Every container of a Deployment, StatefulSet, DaemonSet, ReplicaSet, ReplicationController, Job, CronJob or Pod becomes a Compose service. Services decide which ports are published, PersistentVolumeClaims and StatefulSet volumeClaimTemplates become named volumes, and kubectl List output (kubectl get ... -o yaml) is read too. ConfigMaps, Secrets, Ingress, HorizontalPodAutoscalers and other kinds have no Compose equivalent; they are named in the notes at the top of the output.
How are command and args mapped?
Kubernetes command replaces the image's entrypoint and args replaces its default command, so command becomes entrypoint and args becomes command in Compose. References like $(NAME) are filled in from the container's own env the way Kubernetes does it, and $$ becomes a single $. Every remaining dollar sign is written as $$ so Docker Compose passes it through instead of reading a variable from your shell.
Will my environment values change?
No. Values are copied exactly as written, so 8901240544102066246, 00501, 14.50, true or yes stay that text, and each one is written in double quotes so no YAML reader turns it into a number or a boolean. Variables that come from the cluster (secretKeyRef, configMapKeyRef, fieldRef, envFrom) are not in the manifests, so they are left out and listed in the notes for you to fill in.
What happens to pods with more than one container?
Each container becomes its own service, named after the workload and the container (web-nginx, web-log-shipper). Containers in one pod talk to each other over localhost, so the extra containers get network_mode: service:<first container>, which shares the network in Compose too. All of the pod’s ports are published on the first container’s service, and an emptyDir shared between containers becomes a named volume.
How are ports and replicas handled?
A Service port is published on your machine as port:targetPort, with named target ports looked up on the container and UDP kept. Container ports no Service points at are listed under expose, so other services can still reach them. If a Deployment asks for several replicas but publishes a port, the replica count is left out, because two copies can’t both bind the same host port; the note explains how to scale instead.
Can I convert a Helm chart?
Render it first with helm template my-release ./my-chart and paste the result. The rendered YAML is ordinary Kubernetes manifests, separated by ---, and every workload in it is converted.
Is my YAML uploaded anywhere?
No. The conversion runs in your browser, so the manifests you paste or upload never leave your computer. Nothing is kept: a reload starts with an empty editor.
Related Tools
Docker Compose to Kubernetes
Convert Docker Compose files to Kubernetes manifests with Deployments, Services, and PVCs
Kubernetes YAML Fixer
Fix broken Kubernetes manifests automatically, repair Deployment, Service, Pod, and ConfigMap YAML errors
Docker Compose to Helm
Generate complete Helm charts from Docker Compose files with templates and values
Kubernetes to Helm Chart
Generate Helm charts from Kubernetes manifests with Chart.yaml, values.yaml, and templates
Helm to Kubernetes
Convert Helm charts to plain Kubernetes manifests by rendering templates with values
Kustomize to Helm
Convert Kustomize configurations to Helm charts with templates and values