I have a docker-compose.yml
file which specifies two services AAA
and BBB
as follows,
version: "3.4"
services:
AAA:
platform: linux/amd64
build: .
image: AAA
environment:
- ENV_VAR=1
volumes:
- ./data:/root/data
ports:
- 5900:5900
restart: on-failure
BBB:
image: BBB
build: ./service_directory
platform: linux/amd64
environment:
- PYTHONUNBUFFERED=1
volumes:
- ./data:/root/data
ports:
- 5901:5901
restart: on-failure
depends_on:
- AAA
And here's my directory structure:
project
| docker-compose.yml
| Dockerfile
|
|--service_directory
|
|--Dockerfile
I'm led to believe that google cloud lacks direct docker-compose
support, and one must translate the docker compose script into a cloudbuild.yaml
file.
How should one specify the multiple services, the environment
, ports
, volumes
information and the dependency of BBB
on AAA
in a cloudbuild.yaml
file such that both services build on a single compute engine VM instance, as one would otherwise expect from running the docker compose up
command?
CodePudding user response:
Google Compute Engine VMs (running Linux) are functionally equivalent to any other Linux machine and you can run Docker Compose as you would elsewhere.
You may need to install Docker and Docker Compose as you would on any Linux host.
Google Cloud Build provides different functionality to Docker Compose; the two are not equivalent. Cloud Build is a cloud-based pipeline tool that is mostly used (but is not limited) to define the steps needed to create container images.