Skip to content

Menu

Docker Compose to Kubernetes

Convert docker-compose.yml to K8s manifests

Runs entirely in your browserDevOpsFree, no sign-up
Loading tool

01What is Docker Compose to Kubernetes?

A docker-compose.yml is a fine way to run a stack on one machine, but a cluster wants Deployments and Services. This converter gives you that first draft so you don't type the boilerplate by hand. It reads the top-level services: block line by line. It is not a full YAML library, so anchors, merge keys and multi-document files are out of scope. It does cope with 2- or 4-space indentation and trailing comments. For each service it picks up image, command, deploy replicas, ports, environment (list form KEY=value or map form) and volumes. Every service with an image becomes an apps/v1 Deployment with an app: <name> label and a matching selector. Replicas come from the file, or default to 1. Service names are lowercased and anything outside a-z, 0-9 and hyphens turns into a hyphen, because the Kubernetes object names docs require DNS-style labels (RFC 1123). So web_app becomes web-app. Ports follow the Compose short syntax. In "127.0.0.1:53:53/udp" the bind address is dropped, 53 becomes both the Service port and targetPort, and the protocol is UDP. A service with at least one port also gets a ClusterIP Service with the same name, so in-cluster URLs like db:5432 keep working. Compose command becomes args, which matches how Kubernetes treats args: it replaces the image CMD and keeps the ENTRYPOINT. Here's a worked example. A service called dns with image coredns/coredns, port "127.0.0.1:53:53/udp" and volume ./Corefile:/etc/coredns/Corefile:ro gives you a Deployment named dns. It has containerPort 53 with protocol UDP and a read-only volumeMount called corefile-0. It also has an emptyDir volume of the same name with a comment telling you to replace it. A Service named dns follows, after a --- separator. That emptyDir is a placeholder, not a translation. Your Corefile won't be inside it. You need a ConfigMap, Secret or PersistentVolumeClaim, and the mount exists only so the API server accepts the manifest. Know the limits before you apply anything. depends_on, healthcheck, restart, resource limits, networks and build are not translated. Port ranges like "8000-8010:8000-8010" are skipped. Build-only services with no image are listed in a "# Skipped" comment at the top, and if nothing has an image you get an error instead of output. Environment values, passwords included, are copied as plain text.

Backend and platform engineers who have a working docker-compose.yml and need a starting set of Kubernetes Deployments and Services for it. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Docker Compose to Kubernetes

  1. Paste your docker-compose.yml into the Docker Compose panel, or pick one of the built-in examples.
  2. Read the result in the Kubernetes YAML panel. Manifests are separated by --- lines, and an error shows instead if no service has an image.
  3. Look for the "# Skipped" comment and the emptyDir volume comments, and note what you need to fix by hand.
  4. Click Copy YAML and save it to a file such as k8s.yaml.
  5. Replace placeholder volumes, move secrets out of env, add probes and resources, then run kubectl apply -f k8s.yaml.
  6. Use Reset to clear the input for the next file.

03Worked examples

Input: services: web: image: nginx:alpine ports: - "8080:80"
Result: kind: Deployment ... name: web, replicas: 1 image: "nginx:alpine" ports: - containerPort: 80 --- kind: Service ... name: web - name: port-0 port: 8080 targetPort: 80 protocol: TCP type: ClusterIP
Trimmed to the key lines. The host port becomes the Service port and the container port becomes targetPort.
Input: services: api: image: myapp:1.0 environment: - NODE_ENV=production deploy: replicas: 3
Result: spec: replicas: 3 ... image: "myapp:1.0" env: - name: NODE_ENV value: "production"
Trimmed. No ports means no Service is generated, only the Deployment.
Input: services: My_Worker: image: busybox command: sh -c "sleep 3600"
Result: metadata: name: my-worker ... image: "busybox" args: ["sh", "-c", "sleep 3600"]
Trimmed. The name is lowercased with the underscore turned into a hyphen, and the quoted part of command stays one argument.
Input: services: dns: image: coredns/coredns ports: - "127.0.0.1:53:53/udp" volumes: - ./Corefile:/etc/coredns/Corefile:ro
Result: ports: - containerPort: 53 protocol: UDP volumeMounts: - name: corefile-0 mountPath: "/etc/coredns/Corefile" readOnly: true volumes: - name: corefile-0 # from "./Corefile": replace emptyDir with a PVC, ConfigMap or Secret emptyDir: {}
Trimmed to the container section. A Service with port 53, targetPort 53, protocol UDP also follows.
Input: services: app: build: . db: image: postgres:16
Result: # Skipped (no image, build-only): app apiVersion: apps/v1 kind: Deployment metadata: name: db ...
Trimmed. Build-only services are listed at the top. If no service has an image at all, you get an error instead.

04Common use cases

  • Getting a first set of manifests when you move a local Compose stack onto minikube or kind
  • Showing a teammate how each Compose service lines up with a Deployment and a ClusterIP Service
  • Producing base YAML that you then split into a Helm chart or Kustomize overlays
  • Spotting which services are build-only and need an image pushed to a registry before they can run in a cluster
  • Checking how a UDP port mapping, like a DNS or syslog container, will look as a Kubernetes Service
  • Auditing a Compose file for volumes that will need a real PersistentVolumeClaim or ConfigMap

05Tips

  • Run the output through kubectl apply --dry-run=server or kubeconform before applying it. That catches typos you added while editing.
  • Passwords in environment end up as plain value fields. Move them into a Secret and reference them with valueFrom.secretKeyRef.
  • The bind address in a port like 127.0.0.1:8080:80 is dropped. A ClusterIP Service is only reachable inside the cluster anyway, so use kubectl port-forward for local access.
  • An emptyDir mounted at a file path such as /etc/app/config.yml becomes an empty directory. Swap it for a ConfigMap with subPath before the pod starts.
  • Healthchecks aren't converted. Write a readinessProbe yourself, or the Service may send traffic to pods that are still booting.

06Related concepts

Kubernetes Deployment, ClusterIP Service, Docker Compose, kubectl, Kompose.

Frequently Asked Questions

What is Docker Compose to Kubernetes?

Docker Compose to Kubernetes is a free, browser-based developer tool on AIDToolStack. Convert docker-compose.yml to K8s manifests It requires no installation or sign-up and works entirely in your browser.

Is Docker Compose to Kubernetes free to use?

Yes. No sign-up, no fees and no usage cap.

Does Docker Compose to Kubernetes store my data?

No. It runs in your browser; nothing is uploaded.

Cheat sheet

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe