Network cleanup not always working
还没有人认领这个 Issue。
评估
调研方向
从 Core 模块开始,使用报告中的 Testcontainers 和 Docker 版本重现 Docker 网络的创建过程。检查对带有 org.testcontainers 和 org.testcontainers.sessionId 标签的网络进行的清理;当测试创建的网络能够可靠地被移除,并且 IPv4 地址池错误不再复现时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Module
Core
Testcontainers version
1.17.3
Using the latest Testcontainers version?
Yes
Host OS
Linux
Host Arch
x86
Docker version
$ sudo docker version
Client: Docker Engine - Community
Version: 20.10.12
API version: 1.41
Go version: go1.16.12
Git commit: e91ed57
Built: Mon Dec 13 11:45:37 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.12
API version: 1.41 (minimum version 1.12)
Go version: go1.16.12
Git commit: 459d0df
Built: Mon Dec 13 11:43:46 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0
What happened?
We're getting regularly the error Caused by: com.github.dockerjava.api.exception.NotFoundException: Status 404: {"message":"could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network"} in our TC-based tests.
While researching this, I've found that several networks created by TC remain and are not deleted after the tests. For example on our CI agent:
$ sudo docker network ls
NETWORK ID NAME DRIVER SCOPE
fc00e553e083 40fde7d3-324c-42cc-aeac-bfa9cd68cd0d bridge local
0a2f5e0ebc2f 47c53062-6c06-415d-a961-b45cf3f686af bridge local
2b7f4773ec7b 81ea6de2-0237-4eb7-b5c3-ed545f34d33c bridge local
1a56194c0416 38864bbb-de57-4cb3-9fd2-759056daa61c bridge local
d5d4b01c9f0a 41787e72-4ba5-43c2-a83f-6bf6949ca4c1 bridge local
62ae2d1e22f2 52294b16-867d-4a66-930a-3e2432c898f1 bridge local
79bd7f2e9a9a 2628661f-de18-45a8-80bd-f13c7a8f5aa1 bridge local
e2072e729583 a7b7b131-15f4-4dd1-aa7e-35f548f4b7fd bridge local
13ecf70ca868 b29b8b18-9c8a-48cb-b628-763f936a12bc bridge local
88216c595688 bridge bridge local
623732a6b674 c864c52c-f630-42e6-a123-d0ad590063a5 bridge local
08640b19df0f ebaca507-973e-4ba5-be7f-d01987344b3f bridge local
4bcdbd714e78 f9111034-9c6f-4e67-9ce7-89f2719ee689 bridge local
3f318d295a89 host host local
c3aad684575a none null local
If I inspect the networks with the numbers in their name, I can see they're labelled as TC ones:
$ sudo docker network inspect e2072e729583
[
{
"Name": "a7b7b131-15f4-4dd1-aa7e-35f548f4b7fd",
"Id": "e2072e729583dd48d347dc333dc7a0f05f5627d93f3a4514cf25a2c76cfced00",
"Created": "2022-07-20T04:22:05.82718144Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.21.0.0/16",
"Gateway": "172.21.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {},
"Labels": {
"org.testcontainers": "true",
"org.testcontainers.sessionId": "91cbf7fa-3a02-4279-94dd-c59397225ce1"
}
}
]
Is this a known bug/limitation? Is there something I can do about it?
Thanks!
Relevant log output
No response
Additional Information
No response
- 主要语言
- Java
- 星标
- 8.7k
- 派生
- 1.9k
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 9
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
testcontainers/testcontainers-java 的其他 Issue
-
type/bug
难度 2/5 1-3 小时 新手友好度 78/100
testcontainers/testcontainers-java#11997 · 1 条评论 ·
-
[Enhancement]: Document why singleton containers are required under Spring's test context caching 未关闭type/enhancement
难度 1/5 1 小时以内 新手友好度 85/100
testcontainers/testcontainers-java#11967 ·
-
type/bug
难度 2/5 1-3 小时 新手友好度 78/100
testcontainers/testcontainers-java#11941 ·
-
type/bug
难度 2/5 1-3 小时 新手友好度 74/100
testcontainers/testcontainers-java#11829 · 1 条评论 ·
-
type/enhancement
难度 2/5 1-3 小时 新手友好度 65/100
testcontainers/testcontainers-java#11578 ·
查看 testcontainers/testcontainers-java 的全部 Issue
相似的 Issue
-
Bug Java Platform: Java
难度 2/5 1-3 小时 新手友好度 78/100
getsentry/sentry-java#6138 · 1 条评论 ·
-
bug needs triage p2
难度 2/5 1-3 小时 新手友好度 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
bug needs triage
难度 2/5 1-3 小时 新手友好度 76/100