testcontainers / testcontainers/testcontainers-python

Feature: A way to construct a `Network` object for an existing docker network

未关闭
#816 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

🚀 enhancement
主要语言
Python
星标
2.3k
派生
386
平均合并
4 小时 40 分钟
30 天内合并 PR
1

描述

What are you trying to do?

Attach a DockerContainer to an existing network. In my specific case, the network was created as part of a composable setup, and I'd like to attach a new container to that network.

Why should it be done this way?

I suppose my suggestion would be a way to construct a Network object by simply passing the name in as an argument. Best I can tell that name property is all that is really needed when the DockerContainer is started.

A perhaps easier way might be to create a new class

class ExistingNetwork:
    def __init__(self, network_name: str):
        self.name = network_name

While this I think could be passed into DockerContainer.with_network & it seems to work, it might be better to have this inherit Network and explicitly override the other methods in the Network class to ensure they are not called.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 core/testcontainers/core/network.py 中 Network 的 name 属性附近开始,并检查 DockerContainer.with_network。确定如何表示现有网络的名称而不创建或管理该网络,然后验证 DockerContainer 启动时可以连接到该网络。

由索引模型根据 Issue 内容生成。

评估

技术栈
docker, python
领域
devops, infrastructure
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。