Difference between revisions of "Running Docker containers"

From Tech-Wiki
Jump to: navigation, search
Line 28: Line 28:
 
  docker pull mcr.microsoft.com/windows/servercore/iis
 
  docker pull mcr.microsoft.com/windows/servercore/iis
  
Dockfile example
+
Dockerfile example
 
  FROM mcr.microsoft.com/windows/servercore/iis
 
  FROM mcr.microsoft.com/windows/servercore/iis
 
  RUN powershell -Command blah blah…  
 
  RUN powershell -Command blah blah…  

Revision as of 18:56, 27 August 2023

Back to Windows Server


Install Container feature, install Docker.


Pull an image

docker pull mcr.microsoft.com/windows/nanoserver:ltsc2022

List images

docker images

Run image

docker run -it mcr.microsoft.com/windows/nanoserver:ltsc2022 cmd.exe
echo "Hello World!" > Hello.txt
exit

Update image

docker ps -a
docker commit <containerid> helloworld
docker ps -a (now it shows 2)

Run this custom image

docker run --rm helloworld cmd.exe /s /c type Hello.txt

Pull IIS

docker pull mcr.microsoft.com/windows/servercore/iis

Dockerfile example

FROM mcr.microsoft.com/windows/servercore/iis
RUN powershell -Command blah blah… 
RUN powershell -File  blah.ps1
ADD c:\orion\test\api /inetpub/wwwroot

Run it

docker build -t api-test-image .  
docker run -d -p 80:80 --name api-test-container api-test-image