242 words
1 minute
Installing Docker on Windows Server 2019
Anubhav Gain
2023-12-06

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:

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

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

    Terminal window
    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:

    Terminal window
    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:

    Terminal window
    # 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:

    Terminal window
    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.

Installing Docker on Windows Server 2019
https://mranv.pages.dev/posts/installing-docker-windows-server-2019/
Author
Anubhav Gain
Published at
2023-12-06
License
CC BY-NC-SA 4.0