Network loses labels after docker service restart on Windows #49179
Description
Description
The labels for networks do not persist between Restarts of the docker daemon on Windows. This impacts the usage of docker-compose
with Windows containers because it means that after a restart, the network no longer belongs to a docker-compose project.
The major inconvenience is that this interferes with the OS patching process which implies OS restarts.
When you do the next docker-compose up
on that project it will try to create a new network because it can't track the old one. Since OS updates are recurrent events this issue is a huge inconvenience.
Example of error received after a service restart:
Ran command: docker compose up -d
Received:
time="2024-12-31T07:16:34+02:00" level=warning msg="a network with name monitoringpoc_monitoring exists but was not created by compose.\nSet `external: true` to use an existing network"
network monitoringpoc_monitoring was found but has incorrect label com.docker.compose.network set to "" (expected: "monitoring")
Reproduce
- docker network create --label test --driver nat test
- docker network inspect test. Check that the label
test
has been successfully added. - Restart the Windows service for the docker engine ( or restart the computer to install OS updates)
- docker network inspect test. Check if the label
test
still exists.
Expected behavior
The network labels should be persisted between restarts.
docker version
Client:
Version: 27.4.1
API version: 1.47
Go version: go1.22.10
Git commit: b9d17ea
Built: Tue Dec 17 15:47:22 2024
OS/Arch: windows/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 27.4.1
API version: 1.47 (minimum version 1.24)
Go version: go1.22.10
Git commit: c710b88
Built: Tue Dec 17 15:45:57 2024
OS/Arch: windows/amd64
Experimental: false
docker info
Client:
Version: 27.4.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.17.1
Path: C:\Program Files\Rancher Desktop\resources\resources\win32\docker-cli-plugins\docker-buildx.exe
compose: Docker Compose (Docker Inc.)
Version: v2.32.1
Path: C:\Program Files\docker\cli-plugins\docker-compose.exe
Server:
Containers: 5
Running: 0
Paused: 0
Stopped: 5
Images: 172
Server Version: 27.4.1
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: ics internal l2bridge l2tunnel nat null overlay private transparent
Log: awslogs etwlogs fluentd gcplogs gelf json-file local splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 26100 (26100.1.amd64fre.ge_release.240331-1435)
Operating System: Microsoft Windows Version 24H2 (OS Build 26100.2605)
OSType: windows
Architecture: x86_64
CPUs: 20
Total Memory: 31.69GiB
Name: W2713
ID: 06801546-db59-407b-9897-eb934f4e71d3
Docker Root Dir: C:\ProgramData\docker
Debug Mode: true
File Descriptors: -1
Goroutines: 32
System Time: 2024-12-31T07:00:56.0002678+02:00
EventsListeners: 0
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
Additional Info
Example of reproduced issue:
Before restart:
[
{
"Name": "test",
"Id": "62e4352912dcfd44f9d34b593bb1ff57f04877cdd6f3e5a2992073e0c57c6c04",
"Created": "2024-12-31T06:56:42.5609013+02:00",
"Scope": "local",
"Driver": "nat",
"EnableIPv6": false,
"IPAM": {
"Driver": "windows",
"Options": {},
"Config": [
{
"Subnet": "172.20.32.0/20",
"Gateway": "172.20.32.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"com.docker.network.windowsshim.hnsid": "E2DF58DC-315F-4392-BF08-9E0A1FBB4560"
},
"Labels": {
"test": ""
}
}
]
After restart:
[
{
"Name": "test",
"Id": "62e4352912dcfd44f9d34b593bb1ff57f04877cdd6f3e5a2992073e0c57c6c04",
"Created": "2024-12-31T06:59:05.7069388+02:00",
"Scope": "local",
"Driver": "nat",
"EnableIPv6": false,
"IPAM": {
"Driver": "windows",
"Options": null,
"Config": [
{
"Subnet": "172.20.32.0/20",
"Gateway": "172.20.32.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"com.docker.network.windowsshim.hnsid": "E2DF58DC-315F-4392-BF08-9E0A1FBB4560",
"com.docker.network.windowsshim.networkname": "test"
},
"Labels": {}
}
]
Activity