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, 605🔥, 0💬
Popular Posts:
Can Two Forms Be Nested? Can two forms be nested? The answer is no and yes: No. You can not nest two...
How to attach console to a Running Container using the "docker container exec" command? I want to ge...
How to install .NET Framework in Visual Studio Community 2017? I have the Visual Studio Installer in...
How To Read the Entire File into a Single String in PHP? If you have a file, and you want to read th...
Where to find tutorials on JSON (JavaScript Object Notation) text string format? I want to know how ...