Skip to content

Installing Docker on Windows Server 2019

Published: at 08:29 AM

Windows Server 2019 - Docker Daemon

Shanghai, China

Installing Docker via OneGet Provider PowerShell Module

Windows containers enable packaging applications with dependencies and leveraging operating system-level virtualization for fast, isolated environments. Here’s how to install Docker using the OneGet provider PowerShell module:

  1. Install the OneGet PowerShell module:

    Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
  2. Use OneGet to install the latest version of Docker:

    Install-Package -Name docker -ProviderName DockerMsftProvider
  3. After installation, reboot the computer:

    Restart-Computer -Force
Windows Server 2019

Downloading Docker Manually

For environments with restricted internet access, follow these steps to manually download and install Docker Engine - Enterprise:

  1. Download the Docker installer archive on a machine with internet access:

    Invoke-WebRequest -UseBasicParsing -OutFile docker-19.03.3.zip https://download.docker.com/components/engine/windows-server/19.03/docker-19.03.3.zip
  2. Extract the archive, register, and start the Docker service:

    # Stop Docker service if an earlier version is installed
    Stop-Service docker
    
    # Extract the archive
    Expand-Archive docker-19.03.3.zip -DestinationPath $Env:ProgramFiles -Force
    
    # Clean up the zip file
    Remove-Item -Force docker-19.03.3.zip
    
    # Install Docker. This requires rebooting
    $null = Install-WindowsFeature containers
    
    Restart-Computer -Force
    
    # Add Docker to the path for the current session
    $env:path += ';$env:ProgramFiles\docker'
    
    # Optionally, modify PATH to persist across sessions
    $newPath = '$env:ProgramFiles\docker;' + [Environment]::GetEnvironmentVariable('PATH',[EnvironmentVariableTarget]::Machine)
    [Environment]::SetEnvironmentVariable('PATH', $newPath, [EnvironmentVariableTarget]::Machine)
    
    # Register the Docker daemon as a service
    dockerd --register-service
    
    # Start the Docker service
    Start-Service docker
  3. Test your Docker EE installation by running the hello-world container:

    docker pull hello-world:nanoserver
    docker images
    docker container run hello-world:nanoserver
Windows Server 2019

This guide covers both automated installation via OneGet and manual installation for environments with restricted internet access.