Loading Docker Compose to Kubernetes Converter...
Please wait a moment

How to Convert Docker Compose to Kubernetes - Step by Step Guide

Step 1

Input Your Docker Compose File

Start with the Docker Compose file you already run locally. If you are moving those containers to Kubernetes, this saves you writing the first set of manifests by hand. If the YAML itself needs tidying first, the YAML formatter can help. There are three ways in:

•
Paste directly: Copy your docker-compose.yml content and paste it into the input editor
•
Upload a file: Click Upload to pick your docker-compose.yml or compose.yaml
•
Try the sample: Click Sample to load a three-service example with nginx, a Node.js API and PostgreSQL

Example: Docker Compose Input

A single nginx service with a published port, one environment variable and a named volume:

version: '3.8'

services:
  web:
    image: nginx:latest
    ports:
      - "80:80"
    environment:
      - ENV=production
    volumes:
      - web-data:/usr/share/nginx/html
    restart: always

volumes:
  web-data:
Step 2

Read the Generated Manifests

The output updates a moment after you stop typing. It is one YAML file with the documents separated by ---, in the order kubectl apply handles best, and it starts with notes on anything that did not carry over. You get these Kubernetes objects:

•
Deployments: one per service, with its image, command, ports, environment, resource limits and volume mounts
•
Services: one for each service that publishes or exposes ports, named after it, so other pods reach it the same way as in Compose (how Services work)
•
PersistentVolumeClaims: one per named volume, asking for 1Gi; it starts empty, nothing is copied from your Docker volume
•
Environment variables: copied exactly as typed and written in quotes, so values like 00501 or yes stay text

Example: Generated Kubernetes Deployment

The Deployment made from the service above. The output also holds a PersistentVolumeClaim for web-data and a Service for port 80:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
  labels:
    app: web
spec:
  replicas: 1
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
        - name: web
          image: nginx:latest
          ports:
            - containerPort: 80
              protocol: TCP
          env:
            - name: ENV
              value: "production"
          volumeMounts:
            - name: vol-1
              mountPath: /usr/share/nginx/html
      volumes:
        - name: vol-1
          persistentVolumeClaim:
            claimName: web-data
Step 3

Set the Options

Click Options above the input to adjust what gets written:

•
Namespace: added to every manifest; leave it empty to use the namespace kubectl is pointed at
•
Service Type: ClusterIP (the default, reachable only inside the cluster), NodePort or LoadBalancer
•
Default Replicas: used for services that don't set deploy.replicas
•
Storage Class: written into every PersistentVolumeClaim (for example standard or fast-ssd)
Step 4

Export and Deploy Your Kubernetes Manifests

Take the manifests with you in whichever form suits your repo:

•
Copy: puts the whole YAML, notes included, on your clipboard
•
Download: saves kubernetes-manifests.yaml, one file with every manifest
•
ZIP: one file per manifest (web-deployment.yaml, web-service.yaml and so on) plus NOTES.txt when there are notes

💡 Tip: check before you deploy

Let the cluster check the files first, then apply them:

kubectl apply --dry-run=server -f kubernetes-manifests.yaml kubectl apply -f kubernetes-manifests.yaml

Frequently Asked Questions

How does Docker Compose to Kubernetes conversion work?

Each service in your compose file becomes a Deployment with the same image, command, environment and resource limits. A service that publishes or exposes ports also gets a Service with the same name, so other pods can reach it the way they did in Compose. Each named volume a service mounts becomes a PersistentVolumeClaim. Everything is converted in your browser.

Can I apply the manifests straight to my cluster?

They are valid Kubernetes YAML, but treat them as a first draft. Read the notes at the top of the output: they list what could not be carried over, such as bind mounts, depends_on, health checks, build sections and variables taken from your shell. Claims ask for 1Gi each, passwords sit in plain env values (move them into a Secret), and there are no probes or Ingress. Run kubectl apply --dry-run=server before the real thing.

Which Docker Compose settings are converted?

image, ports and expose (short and long form, /udp kept, host IPs dropped, small ranges written out), environment in list or map form, command and entrypoint, deploy.replicas, deploy.resources and the older cpus and mem_limit (memory like 512M becomes 512Mi), named volumes, anonymous and tmpfs volumes (as emptyDir) and read-only mounts. YAML anchors and <<: merge keys are resolved first. depends_on, healthcheck, build, networks, secrets, configs, labels and env_file are not converted and are named in the notes.

Will my environment values change?

No. Values are copied exactly as you typed them, so 8901240544102066246, 00501, 14.50, true or yes stay that text. Every env value is written in double quotes, because Kubernetes only accepts strings there and an unquoted yes or 00501 would be read as something else. A $$ in your compose file becomes a single $, as Docker Compose does.

Can I convert a compose file with several services?

Yes. Every service gets its own Deployment, and its own Service when it has ports. Names are turned into valid Kubernetes names (db_main becomes db-main) and the note says so, because other containers that connect to it by name need the new name. A service without ports gets no Service, so nothing else can reach it by name until you add one.

What do the options do?

Namespace adds metadata.namespace to every manifest. Service Type sets the type of each generated Service; it starts as ClusterIP, so nothing is exposed outside the cluster unless you pick NodePort or LoadBalancer. Default Replicas is used for services without deploy.replicas, and Storage Class is written into every PersistentVolumeClaim.

Is my compose file uploaded anywhere?

No. The conversion runs in your browser, so the file you paste or upload, including any passwords in it, never leaves your computer.