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, 722🔥, 0💬
Popular Posts:
How to detect errors occurred in the json_decode() call? You can use the following two functions to ...
Where Is the Submitted Form Data Stored in PHP? When a user submit a form on your Web server, user e...
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as...
How to convert JSON Objects to PHP Associative Arrays using the json_decode() function? Actually, JS...
How to use the "return-response" Policy statement to build the response from scratch for an Azure AP...