TechShizz | Installing and working with Windows Containers in Server 2016

Installing and working with Windows Containers in Server 2016

Installing Docker

First, Install "Containers" Feature from Windows Features.

Run PowerShell as administrator:

## Install the module, pull down from internet
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
##Say yes to install Nuget

## Install the package
Install-Package -Name Docker -ProviderName DockerMsftProvider
##Confirm install.


Installing the base OS

You can do this either in PowerShell or CMD (as admin)

docker pull microsoft/nanoserver
docker pull microsoft/windowsservercore

Containers are created in the file system here: C:\ProgramData\Docker\Containers

Here are some basic commands:
docker images - Shows the current images available.
docker run -it mimcrosoft/nanoserver cmd - Runs a new container with a nanoserver base and runs CMD. You can see the container running in C:\ProgramData\Docker\Containers. If you type "hostname" you'll see the hostname is infact a new one, not the name of your physical host.

docker ps -a - Shows all containers currently running on the server and the container ID.

If you "exit" from the cmd, this will stop the container since no processes are running.

If the container stops, you can start it again with:
docker start <containerid>

If you wanted to get into a cmd in the container again you could do:
docker exec -it <containerid> cmd

docker commit <containerid> <name>
docker commit 11dfds1sf1 containerone

docker run --rm <name> <command> -- --rm removes the container once finished.

Add comment