Установка docker windows server 2016

Installing Docker on Windows Server 2016

To install docker on Windows Server 2016, you need to run few commands, and you will get things ready for your containerization world.

I will share with you the installation steps and some docker commands and then the errors (another article) that I have faced during this process.

Windows Server 2016 shipped with Docker Enterprise Edition for Windows Server (Docker EE) that enables Windows Server to run Docker-based containers.

Although developers today use to run many commands to get installation files online and to configure their tools afterward, in Windows world you simply need to run two commands to install it, and you will get the job done:

1- Open your PowerShell prompt and run the following lines

Install-Module DockerMsftProvider -Force

Install-Package Docker -ProviderName DockerMsftProvider –Force

It will take few minutes to get your system ready, and in most cases, you will need to restart your machine to apply your configuration.

You may write the below command, and it will till you if you need to restart or not.

Once you have restarted your windows server, you can start using your new Docker host
Simple actions to begin with like get docker image and run it.
To get an image, you can use pull command as below

You can also get docker run Windows nano image which is the lightest version of windows today.

You can run the container by just docker run command; you shall add some parameters to modify how your container starts.
In the next commands, I ran PowerShell inside the container to get inside the container.

In the following screenshot, you can see that I run hostname and I got machine id as hostname
also, I ran ipconfig and it show that interface name is vEthernet (Container NIC)

Развертывание узла контейнера: Windows Server Container host deployment: Windows Server

Чтобы развернуть узел контейнера Windows, нужно выполнить разные действия в зависимости от типа операционной системы виртуальной машины и операционной системы сервера виртуальных машин (виртуальная и физическая). Deploying a Windows container host has different steps depending on the operating system and the host system type (physical or virtual). Этот документ описывает развертывание узла контейнера Windows в Windows Server 2016 или Windows Server Core 2016 в физической или виртуальной системе. This document details deploying a Windows container host to either Windows Server 2016 or Windows Server Core 2016 on a physical or virtual system.

Установка Docker Install Docker

Docker необходим для работы с контейнерами Windows. Docker is required in order to work with Windows containers. Docker состоит из подсистемы Docker Engine и клиента Docker. Docker consists of the Docker Engine and the Docker client.

Для установки Docker будет использоваться модуль PowerShell поставщика OneGet. To install Docker, we’ll use the OneGet provider PowerShell module. Поставщик обеспечит работу контейнеров на компьютере и установит Docker. После этого потребуется перезагрузка. The provider will enable the containers feature on your machine and install Docker, which will require a reboot.

Откройте сеанс PowerShell с повышенными правами и выполните следующие командлеты. Open an elevated PowerShell session and run the following cmdlets.

Установите модуль OneGet PowerShell. Install the OneGet PowerShell module.

С помощью OneGet установите последнюю версию Docker. Use OneGet to install the latest version of Docker.

После завершения установки перезагрузите компьютер. When the installation is complete, reboot the computer.

Установка конкретной версии Docker Install a specific version of Docker

На данный момент для Docker EE для Windows Server доступно два канала: There are currently two channels available for Docker EE for Windows Server:

  • 17.06 — используйте эту версию, если вы используете Docker Enterprise Edition (Docker Engine, UCP, DTR). 17.06 — Use this version if you’re using Docker Enterprise Edition (Docker Engine, UCP, DTR). 17.06 используется по умолчанию. 17.06 is the default.
  • 18.03 — используйте эту версию, если вы используете только подсистему Docker EE Engine. 18.03 — Use this version if you’re running Docker EE Engine alone.

Чтобы установить конкретную версию, используйте флаг RequiredVersion . To install a specific version, use the RequiredVersion flag:

Читайте также:  Windows mini pc 4gb ram

Для установки конкретных версий Docker EE может потребоваться обновление ранее установленных модулей DockerMsftProvider. Installing specific Docker EE versions may require an update to previously installed DockerMsftProvider modules. Чтобы его выполнить, воспользуйтесь следующей командой: To Update:

Обновление Docker Update Docker

Если необходимо обновить более раннюю версию канала подсистемы Docker EE Engine до более поздней, используйте флаги -Update и -RequiredVersion . If you need to update Docker EE Engine from an earlier channel to a later channel, use both the -Update and -RequiredVersion flags:

Установка базовых образов контейнеров Install base container images

Перед началом работы с контейнерами Windows необходимо установить базовый образ. Before working with Windows containers, a base image needs to be installed. Базовые образы доступны при использовании Windows Server Core и Nano Server в качестве операционной системы контейнера. Base images are available with either Windows Server Core or Nano Server as the container operating system. Подробные сведения об образах контейнеров Docker см. в разделе Создание собственных образов на сайте docker.com. For detailed information on Docker container images, see Build your own images on docker.com.

Начиная с мая 2018 года, для обеспечения единообразных и надежных возможностей приобретения почти все образы контейнеров, полученные от Майкрософт, обслуживаются из Реестра контейнеров Майкрософт, mcr.microsoft.com. При этом текущий процесс обнаружения через Docker Hub остается неизменным. With effect from May 2018, delivering a consistent and trustworthy acquisition experience, almost all of the Microsoft-sourced container images are served from the Microsoft Container Registry, mcr.microsoft.com, while maintaining the current discovery process via Docker Hub.

Windows Server 2019 и более поздних версий Windows Server 2019 and newer

Чтобы установить базовый образ Windows Server Core, выполните следующую команду: To install the ‘Windows Server Core’ base image run the following:

Чтобы установить базовый образ Nano Server, выполните следующую команду: To install the ‘Nano Server’ base image run the following:

Windows Server 2016 (версии 1607–1803) Windows Server 2016 (versions 1607-1803)

Чтобы установить базовый образ Windows Server Core, выполните следующую команду: To install the Windows Server Core base image run the following:

Чтобы установить базовый образ Nano Server, выполните следующую команду: To install the Nano Server base image run the following:

Прочтите лицензионное соглашение для образов ОС контейнеров Windows на странице Лицензионное соглашение. Please read the Windows containers OS image EULA, which can be found here – EULA.

Узел с изоляцией Hyper-V Hyper-V isolation host

Для запуска изоляции Hyper-V необходима роль Hyper-V. You must have the Hyper-V role to run Hyper-V isolation. Если сам узел контейнера Windows является виртуальной машиной Hyper-V, перед установкой роли Hyper-V необходимо включить вложенную виртуализацию. If the Windows container host is itself a Hyper-V virtual machine, nested virtualization will need to be enabled before installing the Hyper-V role. Дополнительные сведения о вложенной виртуализации см. в статье Вложенная виртуализация. For more information on nested virtualization, see Nested Virtualization.

Вложенная виртуализация Nested virtualization

Приведенный ниже сценарий настраивает вложенную виртуализацию для узла контейнера. The following script will configure nested virtualization for the container host. Этот сценарий выполняется на родительском компьютере Hyper-V. This script is run on the parent Hyper-V machine. Перед запуском сценария убедитесь, что виртуальная машина узла контейнера отключена. Ensure that the container host virtual machine is turned off when running this script.

Включение роли Hyper-V Enable the Hyper-V role

Чтобы включить компонент Hyper-V с помощью PowerShell, выполните приведенный ниже командлет в сеансе PowerShell с повышенными правами. To enable the Hyper-V feature using PowerShell, run the following cmdlet in an elevated PowerShell session.

Container host deployment: Windows Server

Deploying a Windows container host has different steps depending on the operating system and the host system type (physical or virtual). This document details deploying a Windows container host to either Windows Server 2016 or Windows Server Core 2016 on a physical or virtual system.

Install Docker

Docker is required in order to work with Windows containers. Docker consists of the Docker Engine and the Docker client.

To install Docker, we’ll use the OneGet provider PowerShell module. The provider will enable the containers feature on your machine and install Docker, which will require a reboot.

Open an elevated PowerShell session and run the following cmdlets.

Install the OneGet PowerShell module.

Use OneGet to install the latest version of Docker.

When the installation is complete, reboot the computer.

Install a specific version of Docker

There are currently two channels available for Docker EE for Windows Server:

  • 17.06 — Use this version if you’re using Docker Enterprise Edition (Docker Engine, UCP, DTR). 17.06 is the default.
  • 18.03 — Use this version if you’re running Docker EE Engine alone.

To install a specific version, use the RequiredVersion flag:

Installing specific Docker EE versions may require an update to previously installed DockerMsftProvider modules. To Update:

Update Docker

If you need to update Docker EE Engine from an earlier channel to a later channel, use both the -Update and -RequiredVersion flags:

Читайте также:  Как исправить ошибку 0xc000007b для windows 10

Install base container images

Before working with Windows containers, a base image needs to be installed. Base images are available with either Windows Server Core or Nano Server as the container operating system. For detailed information on Docker container images, see Build your own images on docker.com.

With effect from May 2018, delivering a consistent and trustworthy acquisition experience, almost all of the Microsoft-sourced container images are served from the Microsoft Container Registry, mcr.microsoft.com, while maintaining the current discovery process via Docker Hub.

Windows Server 2019 and newer

To install the ‘Windows Server Core’ base image run the following:

To install the ‘Nano Server’ base image run the following:

Windows Server 2016 (versions 1607-1803)

To install the Windows Server Core base image run the following:

To install the Nano Server base image run the following:

Please read the Windows containers OS image EULA, which can be found here – EULA.

Hyper-V isolation host

You must have the Hyper-V role to run Hyper-V isolation. If the Windows container host is itself a Hyper-V virtual machine, nested virtualization will need to be enabled before installing the Hyper-V role. For more information on nested virtualization, see Nested Virtualization.

Nested virtualization

The following script will configure nested virtualization for the container host. This script is run on the parent Hyper-V machine. Ensure that the container host virtual machine is turned off when running this script.

Enable the Hyper-V role

To enable the Hyper-V feature using PowerShell, run the following cmdlet in an elevated PowerShell session.

Introducing Docker for Windows Server 2016

Today, Microsoft is announcing general availability of Windows Server 2016 at the Ignite conference in Atlanta. For Windows developers and IT-pros, the most exciting new Windows feature is containers, and containers on Windows Server 2016 are powered by Docker.

This blog post details the technical innovations that went into making Docker containers run natively on Windows and attempts to explain the significance of the achievement. See the companion blog posts on how to build your first Windows container and the post detailing Docker Inc. and Microsoft’s commercial partnership to support Docker on Windows.

The first version of Docker was released in 2013, and in the 3 years since launch, Docker has completely transformed how Linux developers and ops build, ship and run apps. With Docker Engine and containers now available natively on Windows, developers and IT-pros can begin the same transformation for Windows-based apps and infrastructure and start reaping the same benefits: better security, more agility, and improved portability and freedom to move on-prem apps to the cloud.

For developers and IT-pros that build and maintain heterogenous deployments with both Linux and Windows infrastructure, Docker on Windows holds even greater significance: The Docker platform now represents a single set of tools, APIs and image formats for managing both Linux and Windows apps. As Linux and Windows apps and servers are dockerized, developers and IT-pros can bridge the operating system divide with shared Docker terminology and interfaces for managing and evolving complex microservices deployments both on-prem and in the cloud.

Running Containers on Windows Server

Docker running containers on Windows is the result of a two-year collaboration between Microsoft that involved the Windows kernel growing containerization primitives, Docker and Microsoft collaborating on porting the Docker Engine and CLI to Windows to take advantage of those new primitives and Docker adding multi-arch image support to Docker Hub.

The result is that the awesome power of docker run to quickly start a fresh and fully isolated container is now available natively on Windows:

The kernel containerization features are available in all versions of Windows Server 2016, and are also on Windows 10 systems with the Anniversary Update, and the Windows-native Docker daemon runs on both Windows Server 2016 and Windows 10 (although only containers based on Windows Server build and run on Windows 10).

docker run on Windows comes with the same semantics as on Linux: Full process isolation and sandboxed filesystem (and Windows Registry!) with support for layering changes. Each container sees a clean Windows system and cannot interfere with other processes (containerized or not) on the system.

For example, two dockerized apps using different Internet Information Services (IIS) versions and different .NET frameworks can co-exist merrily on the same system. They can even write to their respective filesystems and registries without affecting each other.

With containerization, Windows IT-pros get most of the isolation and release-artifact-stability benefits of VMs, without the resource overhead and lost agility inherent in hardware virtualization.

Similar to how containers on Linux can run with different security profiles, containers on Windows run in one of two isolation modes:

  1. Windows Server Containers use the same shared-kernel process-isolation paradigm known from Linux. Since containers run as normal (but isolated) processes, startup is fast and resource overhead is minimal.
  2. With Hyper-V isolation, container processes run inside a very minimal hypervisor created during container start. This yields potentially better isolation at the cost of slower startup and some resource overhead.
Читайте также:  Tascam us 366 драйвера для windows 10

Isolation can be set with a simple switch passed to docker run :

As long as the underlying host supports the requested isolation mode, any Windows container image can be run as either a hyper-v or server container and a container host can run both side by side. Container processes are oblivious to the isolation mode they run in, and the Docker control API is the same for both modes.

This makes isolation mode not generally a developer concern and developers should use the default or what’s convenient on their system. Isolation mode does give IT-pros options when choosing how to deploy containerized apps in production.

Also note that, while Hyper-V is the runtime technology powering hyper-v isolation, hyper-v isolated containers are not Hyper-V VMs and cannot be managed with classic Hyper-V tools.

For readers interested in details of how containers are implemented on Windows, John Starks’ black belt session at DockerCon ‘16 is a great introduction.

Building Windows Container Images

Thanks to layering improvements to the Windows Registry and filesystem, docker build and Dockerfiles are fully supported for creating Windows Docker images. Below is an example Windows Dockerfile that Stefan Scherer has proposed for the Node.js official Docker library image. It can be built on Windows with docker build :

Note how PowerShell is used to install and setup zip files and exes: Windows containers run Windows executables compiled for Windows APIs. To build and run a Windows container, a Windows system is required. While the Docker tools, control APIs and image formats are the same on Windows and Linux, a Docker Windows container won’t run on a Linux system and vice-versa.

Also note that the starting layer is microsoft/windowsservercore . Starting FROM scratch is not an option when creating Windows container images. Instead, images are based on either microsoft/windowsservercore or microsoft/nanoserver .

The Windows Server Core image comes with a mostly complete userland with the processes and DLLs found on a standard Windows Server Core install. With the exception of GUI apps and apps requiring Windows Remote Desktop, most apps that run on Windows Server can be dockerized to run in an image based on microsoft/windowsservercore with minimal effort. Examples include Microsoft SQL Server, Apache, Internet Information Services (IIS) and the full .NET framework.

This flexibility comes at the cost of some bulk: The microsoft/windowsservercore image takes up 10GB. Thanks to Docker’s highly efficient image layering, this is not a big problem in practice. Any given Docker host only needs to pull the base layer once, and any images pulled or built on that system simply reuse the base layer.

The other base layer option is Nano Server, a new and very minimal Windows version with a pared-down Windows API. Lots of software already runs on Nano Server, including IIS, the new .NET Core framework, Node.js and Go. And the Nano Server base image is an order of magnitude smaller than Windows Server Core, meaning it has less dependencies and surface area to keep updated. Nano Server is an exciting development, not only as a base for minimal containers that build and boot quickly, but also as a Minimalist Operating System that makes for a great container host OS running just the Docker daemon and containers, and nothing else.

With the choice of Windows Server Core and Nano Server, developers and IT-pros can opt to lift-and-shift existing Windows-based apps into Server Core containers or adopt Nano Server for greenfield development or incrementally as part of breaking monolithic apps into microservices components.

Docker is working with Microsoft and the community to build container images based on both Windows Server Core and Nano Server. Golang, Python and Mongo are available as official Docker images (more are on their way), and Microsoft also maintains a set of very popular sample images.

Summary

Today’s announcement of Docker Engine building, running and managing containers on Windows is the fruit of years of labor by teams at both Microsoft and Docker and by the Docker community. We’re incredibly proud of the work we’ve done with Microsoft to bring the benefits of containerization to Windows developers and IT-pros, and we’re excited about the prospect of getting Windows and Linux technologists building, shipping and running apps together with a common set of tools and APIs.

Here are some resources to help you get started

  • Sign up to be notified of GA and the Docker Datacenter for Windows Beta
  • Register for a webinar: Docker for Windows Server
  • Learn more about the Docker and Microsoft partnership
Оцените статью