Description
Calling restart on a stopped Hyper-V container fails to start.
Steps to reproduce the issue:
- docker run -id --name test --isolation=hyperv microsoft/nanoserver
- docker stop test
- docker restart test
Describe the results you received:
PS H:\bin\containerd> docker restart test
Error response from daemon: Cannot restart container test: container 5e8c7300e90ccf88bd47fbbaefb18efed80fa99bffda4df904f599738fc8620e
encountered an error during CreateContainer: failure in a Windows system call: The handle is invalid. (0x6)
Note that this error is not the actual underlying error, but due to a platform bug, the actual error is swallowed in HCS. The real error (taken from an RS3 host) is:
PS C:\Users\Administrator> docker restart test
Error response from daemon: Cannot restart container 277: container 2771043d3ac01744b6735e8a4dc82ca9bd39c42055a23de6e9bc7f4aa9e8121d encountered an error during CreateContainer: failure in a Windows system call: The process cannot access the file because it is being used by another process. (0x20) extra info: {"SystemType":"Container","Name":"2771043d3ac01744b6735e8a4dc82ca9bd39c42055a23de6e9bc7f4aa9e8121d","Owner":"docker","LayerFolderPath":"C:\\ProgramData\\docker\\windowsfilter\\2771043d3ac01744b6735e8a4dc82ca9bd39c42055a23de6e9bc7f4aa9e8121d","Layers":[{"ID":"9b53aba3-d12d-5df8-8e7a-8c4aac7978eb","Path":"C:\\ProgramData\\docker\\windowsfilter\\b6cb5f90f3125009774e890ef23c25f8b93caa2fe0dc2725abac449b713cf104"},{"ID":"83b38d1d-b76d-58ad-86d5-e7b34017da8d","Path":"C:\\ProgramData\\docker\\windowsfilter\\ceacfe10ea489a47e0ef6e4b2339bc7ecb46c857d062b5eb9f40a111632a6565"},{"ID":"650a121f-1f04-573a-b3de-341289947a0d","Path":"C:\\ProgramData\\docker\\windowsfilter\\ce160e6e2bcd666ad5ffe87ddab6ea4d1a40291b192cf6a81489872e26f76f50"},{"ID":"6a2cbde0-04af-50cc-a650-ec678a456ff2","Path":"C:\\ProgramData\\docker\\windowsfilter\\a12f34ee057b7aadc08960f4d2a25ca57dd035b23653c3610955f702a2f352bd"},{"ID":"d9c425e9-cdd3-54d5-8aa7-8f38b03e8040","Path":"C:\\ProgramData\\docker\\windowsfilter\\04b62a02507e3aaa94c8d67a46858b997bcf10c0816b788929caf7eba9c3de5d"},{"ID":"d31c8d45-feb6-50c6-a22f-291051bcfa5b","Path":"C:\\ProgramData\\docker\\windowsfilter\\eb905cfd559ce5c7945bcf007fa72e5c629e5c7e42f1bf0a4608861f8545874d"}],"HostName":"2771043d3ac0","HvPartition":true,"EndpointList":["ada36780-09af-4b62-a32b-29e6329365ea"],"HvRuntime":{"ImagePath":"C:\\ProgramData\\docker\\windowsfilter\\04b62a02507e3aaa94c8d67a46858b997bcf10c0816b788929caf7eba9c3de5d\\UtilityVM"},"AllowUnqualifiedDNSQuery":true}
Describe the results you expected:
Container should be started.
Additional information you deem important (e.g. issue happens only occasionally):
This is 100% repro, but only with Hyper-V containers.
This is not a timing issue, docker restart will never start the container no matter how long you wait.
This does not occur when docker start is used instead of docker restart.
This does not occur if docker restart is used on a running container.
This does occur on a fresh container created with docker create ... followed by docker restart to start it.
Get-ComputeProcess does not return any running containers.
I see no extra volumes mounted on the host after the container has failed, it's possible one is mounted when it should not be while the container is being started, but I don't see that in the logs.
Output of docker version:
PS C:\Users\Administrator> docker version
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:09 2017
OS/Arch: windows/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.24)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:50:27 2017
OS/Arch: windows/amd64
Experimental: false
Also tested on daemon from master today:
PS C:\Users\Administrator> docker version
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:09 2017
OS/Arch: windows/amd64
Server:
Version: master-dockerproject-2017-11-07
API version: 1.35 (minimum version 1.24)
Go version: go1.8.5
Git commit: bd8ed57
Built: Tue Nov 7 23:52:56 2017
OS/Arch: windows/amd64
Experimental: false
Output of docker info:
PS C:\Users\Administrator> docker version
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:09 2017
OS/Arch: windows/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.24)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:50:27 2017
OS/Arch: windows/amd64
Experimental: false
PS C:\Users\Administrator> docker info
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 1
Server Version: 17.09.0-ce
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: ics l2bridge l2tunnel nat null overlay transparent
Log: awslogs etwlogs fluentd json-file logentries splunk syslog
Swarm: inactive
Default Isolation: process
Kernel Version: 10.0 16299 (16299.15.amd64fre.rs3_release.170928-1534)
Operating System: Windows Server Datacenter
OSType: windows
Architecture: x86_64
CPUs: 2
Total Memory: 1.999GiB
Name: WIN-RE9VNFSKRVS
ID: 3G7D:2JPU:PCYZ:TWDL:O46E:5GYN:I62A:3CBG:A7XI:GJUD:3L7N:L42K
Docker Root Dir: C:\ProgramData\docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: -1
Goroutines: 20
System Time: 2017-11-07T15:55:11.1418494-08:00
EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Additional environment details (AWS, VirtualBox, physical, etc.):
Must be Hyper-V containers, only tested with nested, but I don't think that matters here.
/cc @johnstep @jhowardmsft @jstarks
Description
Calling restart on a stopped Hyper-V container fails to start.
Steps to reproduce the issue:
Describe the results you received:
Note that this error is not the actual underlying error, but due to a platform bug, the actual error is swallowed in HCS. The real error (taken from an RS3 host) is:
Describe the results you expected:
Container should be started.
Additional information you deem important (e.g. issue happens only occasionally):
This is 100% repro, but only with Hyper-V containers.
This is not a timing issue,
docker restartwill never start the container no matter how long you wait.This does not occur when
docker startis used instead ofdocker restart.This does not occur if
docker restartis used on a running container.This does occur on a fresh container created with
docker create ...followed bydocker restartto start it.Get-ComputeProcess does not return any running containers.
I see no extra volumes mounted on the host after the container has failed, it's possible one is mounted when it should not be while the container is being started, but I don't see that in the logs.
Output of
docker version:Also tested on daemon from master today:
Output of
docker info:Additional environment details (AWS, VirtualBox, physical, etc.):
Must be Hyper-V containers, only tested with nested, but I don't think that matters here.
/cc @johnstep @jhowardmsft @jstarks