Loading converter...

How to Turn Kubernetes Manifests into a docker-compose.yml

Step 1

Add your Kubernetes manifests

Start with the Kubernetes manifests you already have: Deployments, Services, StatefulSets, Jobs or plain Pods.

•
Paste: a single manifest, several separated by ---, the output of kubectl get deploy,svc -o yaml, or a rendered Helm chart.
•
Upload: pick a .yaml, .yml or .json file. An empty file leaves the editor as it was.
•
Sample: loads a Deployment and its LoadBalancer Service so you can see what comes out.

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: 80
Step 2

Read the compose file

Each container gets its own Docker Compose service. This is what carries over:

•
Image, command and args: the image as written (registry ports and digests included), command as entrypoint, args as command, and workingDir.
•
Ports: ports of a matching Service are published as port:targetPort, other container ports go under expose, and the Service name stays reachable as a network alias.
•
Environment: plain env values, copied exactly and quoted. Values read from Secrets or ConfigMaps in the cluster are listed in the notes instead.
•
Volumes: PersistentVolumeClaims and claim templates become named volumes, read-only mounts stay read-only, hostPath becomes a bind mount and an emptyDir with medium Memory becomes tmpfs.
•
Resources: CPU and memory limits and requests become deploy.resources limits and reservations, with 500m written as 0.5 and 512Mi as 512m.
•
Restart: controllers restart always; Pods and Jobs keep their restartPolicy (OnFailure as on-failure, Never as no).

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.

Step 3

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: always
•
Check it: docker compose config prints the file the way Docker reads it, which catches mistakes before anything starts.
•
Start it: docker compose up -d, then docker compose logs -f to follow the output.
•
Stop it: 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.