Can Cloud Code use docker-compose to start containers locally?

259 Views Asked by At

When developing locally, can docker-compose be used with Cloud Code to start other containers (like Postgres and Nginx) locally? Is there a way to do this when clicking 'Run/Debug on Cloud Run Emulator'?

2

There are 2 best solutions below

0
On BEST ANSWER

You could look at kompose:

kompose is a convenience tool to go from local Docker development to managing your application with Kubernetes. Transformation of the Docker Compose format to Kubernetes resources manifest may not be exact, but it helps tremendously when first deploying an application on Kubernetes.

That "may not be exact" is unfortunately key: there isn't a 1-1 mapping between every feature in docker-compose and Kubernetes. But kompose will get you most of the way.

Skaffold, the build and deployment tool used under the hood by Cloud Code, can use kompose to convert a docker-compose project:

skaffold init --compose-file docker-compose.yaml

You need to have kompose on your system.

0
On

Cloud Code simply extends your local IDE by adding several features in it that would make it easier to develop, deploy, and debug Cloud Run services or Kubernetes apps. You should still be able to run your usual commands on a separate terminal on your machine.

To see the available features Cloud Code currently have, feel free to check out the official documentation link.