First, run docker ps -a in PowerShell to see a list of containers and take note of the container ID.
Then, create a new image for future use from the modified container. Powershell.exe Add-Content C:\helloworld.ps1 'Write-Host "Hello World"' Still working in an elevated PowerShell session as an Administrator, execute the following commands, which will deploy a container from an existing image and add a basic “Hello World” PowerShell script. You can check this by running docker images.įinally, test the installation by deploying your own container from an existing image. This command downloads the image onto the computer.
Now, in order to create Windows containers, install the Windows Nano Server Base Container image, using the following command: docker pull microsoft/nanoserver ::SetEnvironmentVariable("Path", $env:Path + " C:\Program Files\Docker", ::Machine)įor Docker to fully install, you’ll need to add it as a Windows service using the following commands: dockerd -register-service Then, close PowerShell and start a new session in order for the new path to register. To avoid errors and save steps when starting new PowerShell sessions, add the Docker directory to the path environment variable with the command below.
Here’s how to do it from the command line: $version = (Invoke-WebRequest -UseBasicParsing ).Content.Trim() Invoke-WebRequest "$($version).zip" -OutFile "$env:TEMP\docker.zip" -UseBasicParsingĮxpand-Archive -Path "$env:TEMP\docker.zip" -DestinationPath $env:ProgramFiles Note: don’t reboot after installing the first feature, but do reboot after activating the second feature.Īfter the reboot, you’ll need to download and install Docker. Then, enable the Windows container and Microsoft-Hyper-V features with the following commands in an elevated PowerShell session with Administrator rights: Enable-WindowsOptionalFeature -Online -FeatureName containers –AllĮnable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V –All To enable the container feature, first make sure that you are running the Pro or Enterprise version of Windows 10. Containers used to be based almost exclusively on Linux, but, since the release of the Anniversary update and Windows Server 2016, it is possible to deploy and use Windows containers based on the small-footprint Windows Nano Server (among others).
This enables you to execute Web servers, for example, in a lightweight, portable and isolated environment.