In the last few blog posts, I’ve shown you how to Install and Configure Windows Containers and Docker on a Container host and now I’ll show you how to create Containers.
Get Started
Before you start, It’s Important to know that docker commands and Container names are case sensitive.
To create the most basic Windows Server Container I’ll use the docker command below, which will create a Server Core Container, log me into the Container and will start Powershell.exe
docker run -it microsoft/windowsservercore-insider powershell.exe
If I type hostname, I’ll see the Container’s hostname
To view running Containers, I use the commands below
docker ps - Shows running Containers
docker ps -a – Shows running and not running containers
To exit a running Windows Container, I use Ctrl + P + Q on the keyboard
To exit a running container and turn it off type exit
I could also give my container a name using the –name switch
docker run -it --name Server microsoft/windowsservercore-insider powershell.exe
Delete Container
To delete a container I use
docker rm server
To delete the container at exit use the switch –rm
docker run -it --rm --name server2 microsoft/windowsservercore-insider powershell.exe