Tools, FAQ, Tutorials:
Commands Available on Windows Container
What commands are avaible on a Windows container? Can I run the "DIR" command?
✍: FYIcenter.com
No. You can not run the "DIR" command on a Windows container directly,
because "DIR" is not really a Windows command. "DIR" is actually sub-command
valid in the "CMD" shell environment.
On a Windows container, you can only commands supported with executable files located in the PATH directorires, or commands with path name specified in the command line.
1. Try to run "DIR" command on "microsoft/dotnet-samples". It will not work, because there is no program file to support this command.
C:\fyicenter> docker run --name windows --entrypoint dir microsoft/dotnet-samples docker: Error response from daemon: container 73e94dac1ea3 encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) extra info: {"CommandLine":"dir","WorkingDirectory":"C:\\app","Environment":{"ASP NETCORE_URLS":"http://+:80","DOTNET_RUNNING_IN_CONTAINER":"true","DOT NET_VERSION":"2.2.2"},"CreateStdInPipe":true,"CreateStdOutPipe":true, "CreateStdErrPipe":true,"ConsoleSize":[0,0]}. C:\fyicenter> docker rm windows windows
2. Try to run "powershell" command. It will work, because the powershell.exe program file can be located in PATH directories.
C:\fyicenter> docker run --name windows --entrypoint powershell microsoft/dotnet-samples Windows PowerShell Copyright (C) 2016 Microsoft Corporation. All rights reserved. PS C:\app> C:\fyicenter> docker rm windows
3. Try to run "\windows\system32\cmd.exe" with path name specified. It will work, because the given path does exist on the image:
C:\fyicenter> docker run --name windows --entrypoint \windows\system32\cmd.exe microsoft/dotnet-samples Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved. C:\app> C:\fyicenter> docker rm windows
Ok, we are able to run executable programs on the Docker image, with path name specified or not specified if they can be located in PATH directories.
See next tutorial on how to find out PATH directories of the Windows image.
⇒ PATH Directories of Windows Container
⇐ "docker run --entrypoint" - Override Default Command
2022-02-02, 403👍, 0💬
Popular Posts:
Where to find tutorials on RSS specifications? I want to learn it to describe my API services. Here ...
Where to find tutorials on OpenID? Here is a large collection of tutorials to answer many frequently...
Can Multiple Paragraphs Be Included in a List Item? Yes. You can include multiple paragraphs in a si...
Where to find tutorials on PHP language? I want to know how to learn PHP. Here is a large collection...
How to add request body examples to my Azure API operation to make it more user friendly? If you hav...