0

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:

enter image description here

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:

enter image description here

And this doesn't fail, but it also doesn't name the container.

1
  • @KamilMaciorowski I also tried --name string (but Docker documentation examples, they show other --flagname arguments assigned via =) such as --isolation=hyperv demonstrated here
    – J.Todd
    Apr 9, 2022 at 19:17

1 Answer 1

2

Note the first part of the help message:

$ docker run --help

Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Everything after the image name is overriding the default command and args to that command. So

docker run -it mcr.microsoft.com/windows:20H2 --isolation=hyperv --name=workstation_1

Will run launch a container with the -it options, in a container based on the mcr.microsoft.com/windows:20H2 image, running the command --isolation=hyperv --name=workstation_1. To fix, put these options before the image name:

docker run -it --isolation=hyperv --name=workstation_1 mcr.microsoft.com/windows:20H2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .