gpt4 book ai didi

vscode-remote - vscode-remote 中的多个开发容器

转载 作者:行者123 更新时间:2023-12-03 09:34:03 29 4
gpt4 key购买 nike

我有一个创建多个 Docker 镜像的项目。我想在 vscode-remote 中为每个图像设置一个 devcontainer,以便我可以为每个图像启动一个容器。

我一次只需要启动并连接到一个容器/图像。

是否支持拥有多个 devcontainer 文件?也许像 .devcontainer/devcontainer1.json.devcontainer/devcontainer2.json (假设我只有两个想要使用的图像)?

每个 devcontainer 将使用不同名称的图像,并且还需要不同的 runArgs .

最佳答案

刚刚在这里找到了这个。我检查了文档,因为我也对此感兴趣。并且文档说明了以下内容

In some cases, a single container environment isn't sufficient. Fortunately, Remote - Containers supports Docker Compose managed multi-container configurations.

You can either:

  1. Work with a service defined in an existing, unmodifieddocker-compose.yml.
  2. Create a new docker-compose.yml (or make a copy ofan existing one) that you use to develop a service.
  3. Extend your existing Docker Compose configuration to develop the service.
  4. Use separate VS Code windows to work with multiple Docker Compose-defined services at once.

https://code.visualstudio.com/docs/remote/containers#_using-docker-compose
也许你想检查一下。
您的用例的文档可以在以下页面下找到:
https://code.visualstudio.com/docs/remote/containers-advanced#_connecting-to-multiple-containers-at-once
您可以使用 docker-compose.yml 执行此操作,并且需要具有如下所示的文件夹结构:
enter image description here

关于vscode-remote - vscode-remote 中的多个开发容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58617041/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com