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, ∼1011🔥, 0💬
Popular Posts:
Why am I getting this "Docker failed to initialize" error? After installing the latest version of Do...
What is Azure API Management Gateway? Azure API Management Gateway is the Azure Web server that serv...
Where can I download the EPUB 2.0 sample book "The Metamorphosis" by Franz Kafka? You can following ...
Where to find tutorials on EPUB file format? I want to know how to create EPUB books. Here is a larg...
How to login to Azure API Management Publisher Dashboard? If you have given access permission to an ...