Skip to main content Is it possible to run docker-compose projects inside kubernetes? : r/kubernetes
r/kubernetes icon
Go to kubernetes

Is it possible to run docker-compose projects inside kubernetes?

false

Hello, I've some old projects that I'd like to maintain along new ones in my kubernetes cluster. I thought that the easiest way of doing that might be running said project inside one pod (docker in docker). Is that doable? Google searches don't yield any results, so there have to be some roadblocks :P I don't care about HA for those projects and just want to maintain one infrastructure instead of multiple ones.

EDIT. Thanks for the answers guys, I guess I'll spend some time to properly convert those compose files. Thanks for taking time to answer. Cheers :-)

Archived post. New comments cannot be posted and votes cannot be cast.
Sort by:
Best
Open comment sort options

You can easily convert the docker-compose file to native kubernetes resources. Check this out: https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/

I've tried kompose in one project and had some issues with it (don't really remember what was the problem, I think not all compose fields are easily translatable to kubernetes objects). I guess I'll look into it again to see if it works for those projects.

More replies
More replies

I don't care about HA for those projects

If you are running in Kubernetes, you need to speak in the language where HA is possible. So all the assumptions of running on one node become problematic (storage, network, etc). And places where you could force it to not be HA are not best practices Or are complicated or brittle, like tying to a specific node for local storage.

You could run Docker Compose style on the same container engine running your k8s, like with nerdctl. But that seems icky.

But in the end, if you are looking for simplicity. Rethinking the assumptions made with Docker Compose in the new syntax is going to work out a lot better in the long run. Kompose gets you most of the way there and where it doesn't work are the places that need human thought about how you are running your k8s architecture.

[deleted]

There is a project that converts docker-compose files to Kubernetes files. I tried it a year ago, but wasn't working so well for me, especially local files. The name is Kompose

Yea that was my experience with Kompose as well, that's why I thought maybe it's possible to just run compose inside pod without any translation :P
Just like you I've tried it some time ago, maybe it'll work better this time.

More replies
More replies

Why is this marked NSFW?

It's so bad it's nearly pornographic.

from

Yea, compose inside kubernetes cluster deserves NSFW

More replies

ACORN

The work it would take ChatGPT to convert your compose to a working group of k8s manifest is so small it’s concerning you’d choose such an anti pattern.

Mature Content

This page may contain mature or adult content. To continue, log in to your account or confirm you’re over 18.

By continuing, you also agree that use of this site constitutes acceptance of Reddit’s User Agreement and acknowledgement of our Privacy Policy.

Log In
Go to Home

Want to browse anonymously?

Scan this QR code to download the app now