简体   繁体   English

docker-compose.yml 在单个 Google Compute Engine VM 上指定的多个服务

[英]Multiple Services Specified by docker-compose.yml on a Single Google Compute Engine VM

I have a docker-compose.yml file which specifies two services AAA and BBB as follows,我有一个docker-compose.yml文件,它指定了两个服务AAABBB ,如下所示,

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.我被引导相信谷歌云缺乏直接docker-compose支持,并且必须将 docker 撰写脚本转换为cloudbuild.yaml文件。

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?应该如何在cloudbuild.yaml文件中指定多个服务、 environmentportsvolumes信息以及BBBAAA的依赖性,以便两个服务都构建在单个计算引擎 VM 实例上,正如人们期望运行docker compose up命令?

Google Compute Engine VMs (running Linux) are functionally equivalent to any other Linux machine and you can run Docker Compose as you would elsewhere. Google Compute Engine VM(运行 Linux)在功能上等同于任何其他 Linux 机器,您可以像在其他地方一样运行 Docker Compose。

You may need to install Docker and Docker Compose as you would on any Linux host.您可能需要像在任何 Linux 主机上一样安装 Docker 和 Docker Compose。

Google Cloud Build provides different functionality to Docker Compose; Google Cloud Build提供与 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. Cloud Build 是一种基于云的管道工具,主要用于(但不限于)定义创建容器镜像所需的步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 docker-compose 显示所有不是在 docker-compose.yml 中定义的服务 - docker-compose displaying all services not the one defined in docker-compose.yml 在 Google Compute Engine VM 中运行多服务 docker 撰写脚本 - Running a Multi-service docker compose script in Google Compute Engine VM 我可以将 AWS Copilot 与 docker-compose.yml 文件一起使用吗? - Can I use AWS Copilot with docker-compose.yml file? 关闭 Google Compute Engine VM 时优雅地停止 docker 容器 - Gracefully stop docker container when shutting down Google Compute Engine VM Google Compute Engine VM 实例卡在暂存阶段 - Google Compute Engine VM instance stuck in staging 谷歌计算引擎无法访问虚拟机 - Google Compute Engine Unable to Access VM 重命名 Google Compute Engine VM 实例 - Rename Google Compute Engine VM Instance 无法 SSH 进入我在 Google Cloud 上的 Compute Engine 虚拟机实例 - Unable to SSH into my Compute Engine VM instance on Google Cloud 删除谷歌计算引擎虚拟机中的度量事件文件是否安全 - Is it safe to delete metric events file in google compute engine vm 部署到 Google Compute Engine 的 Docker 镜像不断重启 - Docker image deployed to Google Compute Engine keeps restarting
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM