Home > Software design >  Deploy containers in pod using docker compose volumes
Deploy containers in pod using docker compose volumes

Time:11-06

I was given a docker compose file for superset which included volumes mounted from the repo itself. docker-compose-non-dev.yml

I have to deploy this as containers in a pod in an EKS cluster. I can't figure out how the volumes should be done because the files are mounted locally from the repo when we run

docker-compose up

CodePudding user response:

Docker compose is a tool geared towards local deployments (as you may know) and so it optimizes its workflows with that assumption. One way to work this around is by wrapping the docker image(s) that compose up with the additional files you have on your local environment. For example a wrapper dockerfile would be something like

FROM <original image>
ADD <local files to new image>

The resulting image is what you would run in the cloud on EKS.

Of course there are many other ways to work it around such as using Kubernetes volumes and (pre-)populating them with the local files, or bake the local files in the original image from the get go, etc.

All in all the traditional compose model of thinking (with local file mappings) isn't very "cloud deployments friendly".

CodePudding user response:

You can convert docker-compose.yaml files with a tool called kompose.
It's as easy as running

kompose convert

in a directory containing docker-ccompose.yaml file.
This will create a bunch of files which you can deploy with kubectl apply -f . (or kompose up). You can read more here.

However, even though kompose will generate PersistentVolueClaim manifests, no PersistentVolumes will be created. You have to make those yourself (cluster may try to create PVs by itself, but it's strongly based on PVCs generated by kompose, I would not rely on that).


Docker compose is mainly used for devlopment, testing and single host deployments [reference], which is not exactly what Kubernetes was created for (latter being cloud oriented).

  • Related