-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Networks created in docker-compose file are not labeled with com.docker.compose.project #6636
Comments
Hi @bsideup Thanks for the report. Can you please provide:
|
Hi @chris-crone, Docker Compose v1.23.2 |
Thanks for the follow up. I've confirmed that networks aren't labelled with that example. This appears to be a v2 issue as changing to v3, I see that the network is labelled. Using: version: '3'
services:
redis:
image: redis
networks:
- redis-net
networks:
redis-net: I see: $ docker network inspect 6636_redis-net [13:43:33]
[
{
"Name": "6636_redis-net",
"Id": "1ff9571066bba2d522cc8e7485f496660d6d9528096180b1c8f56996514a7aa8",
"Created": "2019-04-11T11:43:22.8889743Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.31.0.0/16",
"Gateway": "172.31.0.1"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"9eaf0011c9b783085e294617283245a91c570afa765ef45590a33be65775351c": {
"Name": "6636_redis_1",
"EndpointID": "a30b9404a0e9f5e8d7dd8646fc93c10409e9eb9647813700335eac20741494bf",
"MacAddress": "02:42:ac:1f:00:02",
"IPv4Address": "172.31.0.2/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "redis-net",
"com.docker.compose.project": "6636",
"com.docker.compose.version": "1.23.2"
}
}
] |
Hi @chris-crone, Thanks for trying, I did not know that it can be version specific! |
Hey @chris-crone @bsideup -- The reason for this is the v2.0 file format is mapped to an API version that didn't support labels on networks and volumes (see the code here). Using 2.1 or above will solve this issue. |
Closing by inactivity. Looks like changing the version fixes the issue. |
…ge pull Together with using Compose file 2.1 syntax, this is a solution to network cleanup issue described in: * #1767 * #739 * testcontainers/moby-ryuk#2 * docker/compose#6636 Solution to general credential helper authenticated pull issues in: * docker/compose#5854 Tangentially should add support for v3 syntax (not yet tested) re #531
* Upgrade docker-compose image to latest version and perform direct image pull Together with using Compose file 2.1 syntax, this is a solution to network cleanup issue described in: * #1767 * #739 * testcontainers/moby-ryuk#2 * docker/compose#6636 Solution to general credential helper authenticated pull issues in: * docker/compose#5854 Tangentially should add support for v3 syntax (not yet tested) re #531
Description of the issue
Usually, every resource created by Docker Compose contains
com.docker.compose.project
label. But when compose creates a network, it is not labeled.Context information (for bug reports)
Testcontainers' users report a lot of unused, prunnable networks:
testcontainers/testcontainers-java#955
Steps to reproduce the issue
"Labels": {}
Observed result
Networks are not labeled
Expected result
Networks (as well as any other Docker resource created by Docker Compose) should have a consistent
com.docker.compose.project
label setThe text was updated successfully, but these errors were encountered: