This works:
docker run -it mcr.microsoft.com/windows:20H2 --isolation=hyperv
I get a CLI for the container, everything is good.
This doesn't work:
docker run -it mcr.microsoft.com/windows:20H2 --isolation=hyperv --name=workstation_1
When I add the --name=workstation_1
argument, which according to docker run --help
is a valid argument:
I get this error:
docker: Error response from daemon: container 1118d316b0700307943bec10392b39266b79db08350311618fb5bfc247e2fa8d encountered an error during hcsshim::System::CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2)
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(173)\vmcomputeagent.exe!00007FF6EBB1A40B: (caller: 00007FF6EBAD5C8B) Exception(1) tid(398) 80070002 The system cannot find the file specified.
CallContext:[\Bridge_ProcessMessage\VmHostedContainer_ExecuteProcess]
Provider: 00000000-0000-0000-0000-000000000000].
Am I misusing the --name argument? How else should I name my container? I'm scripting this, so need a (practical) way to do it without human intervention.
I can list containers, assume the first one in the list is the new one, and use docker rename
, but using that approach for an automated build pipeline seems undesirable for obvious reasons.
As an alternative, I tried:
docker create mcr.microsoft.com/windows:20H2 --name=workstation_1
and
docker create mcr.microsoft.com/windows:20H2 --name="workstation_1"
Since docker create --help
indicates this is also a valid argument:
And this doesn't fail, but it also doesn't name the container.
--name string
(but Docker documentation examples, they show other--flagname
arguments assigned via=
) such as--isolation=hyperv
demonstrated here