Tools, FAQ, Tutorials:
"docker run --entrypoint" - Override Default Command
How to override the default command in a Docker image using the "docker run --entrypoint" command?
✍: FYIcenter.com
Each Docker image has default command defined as
the "ENTRYPOINT" which will run automatically
when you start the container created from the image.
But you can override it with the "docker run --entrypoint" command.
1. Continue with the "microsoft/dotnet-samples" image. It has the default command defined as "dotnet dotnetapp.dll".
2. Run it with default command overrided as "CMD":
C:\fyicenter> docker run --name windows --entrypoint cmd
--tty --interactive microsoft/dotnet-samples
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\app>dir
725 dotnetapp.deps.json
9,216 dotnetapp.dll
744 dotnetapp.pdb
154 dotnetapp.runtimeconfig.json
4,608 utils.dll
712 utils.pdb
C:\app>
3. Open another window and connect to the container interactive running the CMD shell:
C:\fyicenter> docker exec --tty --interactive windows cmd C:\>dir ...
Ok, we are able to override the default command defined in the image and run the "CMD" command interactively. This gives us a chance to keep the container running so that we can connect to it with "CMD" shell to explore and troubleshoot the container.
⇒ Commands Available on Windows Container
⇐ "docker run microsoft/dotnet-samples" - Test Run
2022-12-15, ∼2815🔥, 0💬
Popular Posts:
Where to find tutorials on Microsoft Azure services? Here is a large collection of tutorials to answ...
How to convert JSON Objects to PHP Associative Arrays using the json_decode() function? Actually, JS...
What is EPUB 2.0 Metadata "dc:creator" and "dc:contributor" elements? EPUB 2.0 Metadata "dc:creator"...
What Happens If One Row Has Missing Columns? What happens if one row has missing columns? Most brows...
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as...