testcontainers / testcontainers/testcontainers-python
Feature: A way to construct a `Network` object for an existing docker network
还没有人认领这个 Issue。
- 主要语言
- 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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 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