Docker on Windows Server 2019

微软自Windows Server 2016开始支持Docker,今天我们将介绍在Windows Server 2019上安装并使用Docker容器。

Install Docker EE on windows server 2019

  1. 启用服务器Hyper-V,Containers特性
Install-WindowsFeature -Name Hyper-V,Containers -IncludeAllSubFeature -IncludeManagementTools
  1. Install Docker EE

Install-Module DockerMSFTProvider Import-Module -Name DockerMSFTProvider -Force Import-Packageprovider -Name DockerMSFTProvider -Force

通过Find-Package docker确认是否安装成功


PS C:\Users\Administrator> Find-Package docker Name Version Source Summary
---- ------- ------ -------
Docker 1.3.2 PSGallery This module helps with development using Docker on localhost. It ...
Docker 18.09.5 DockerDefault Contains Docker EE for use with Windows Server.

安装Docker


Install-Package -Name Docker -Source DockerDefault

启用Docker Linux Container Support

目前基于Windows Container只能运行Windows应用程序。


# Set LCOW_SUPPORTED Variable to 1 for enabled
[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine") # Enable Experimental Features in Dockerd daemon.conf
$configfile = @"
{
"experimental": true
}
"@
$configfile|Out-File -FilePath C:\ProgramData\docker\config\daemon.json -Encoding ascii -Force

在Docker使用 Linux Container时,仍然需要使用Linux kernal。

You should use the latest LCOW release here

Invoke-WebRequest -Uri "https://github.com/linuxkit/lcow/releases/download/v4.14.35-v0.3.9/release.zip" -UseBasicParsing -OutFile release.zip

Expand-Archive release.zip -DestinationPath "$Env:ProgramFiles\Linux Containers\."

Redis on Docker Linux Container

现在我们即可使用 Windows Container或者Linux Container,但是由于目前基于Windows Container只能运行Windows应用程序,所以我们需要使用--platform选择一种容器类型,参考如下


docker run --platform=linux --name redis-server -d -p 6379:6379 --restart=always redis

References

  1. Posted on February 12, 2019 by Ben Thomas,Getting started with Linux Containers on Windows Server 2019
  2. November 16, 2018 by Andy Syrewicze (Chief Editor)

    ,How to Run

    Windows Server 2019 容器化探索-Docker安装的更多相关文章

    1. Windows Server 2019 预览版介绍

      在Windows server 2012.Windows server 2016还未完全普及的情况下,昨天Windows Server团队宣布Windows Server 2019将在2018年的下半 ...

    2. 手把手教您在 Windows Server 2019 上使用 Docker

      配置 Windows 功能 要运行容器,您还需要启用容器功能 Install-WindowsFeature -Name Containers 在 Window Server 2019 上安装 Dock ...

    3. 戴尔PowerEdge T110 Ⅱ服务器U盘安装Windows Server 2019 DataCenter

      一. 下载准备 准备工作——下载Microsoft Windows Server 2019 官方简体中文激活版 (MSDN)原版iso镜像 准备工作——安装刻录软件UltraISO,单文件绿色版就够用 ...

    4. Windows Server 2019安装OpenSSH Server简明教程

      Windows Server 2019安装OpenSSH Server简明教程   Windows Server 2019内置OpenSSH Server组件了.只不过OpenSSH Server默认 ...

    5. MySQL 8.0.18 在 Windows Server 2019 上的安装(ZIP)公开

      AskScuti MySQL : Windows Server 2019 安装 MySQL 8.0 温馨提示:为了展现我最“魅力”的一面,请用谷歌浏览器撩我. 一切就绪,点我开撩

    6. MySQL 8.0.18 在 Windows Server 2019 上的安装(MSI)公开

      AskScuti MySQL : Windows Server 2019 安装 MySQL 8.0 温馨提示:为了展现我最“魅力”的一面,请用谷歌浏览器撩我.那个 IE 啊,我很无奈. 一切就绪,点我 ...

    7. 在Windows Server 2019上安装edge浏览器

      在Windows 2016和2019的正式版本中是不带Edge浏览器的.有些工具.网站也不支持IE浏览器了.对于偶尔需要在服务器上访问这些站点的管理员来说有些不方便.不过可以通过安装三方浏览器或者Ed ...

    8. 【转帖】使用容器化和 Docker 实现 DevOps 的基础知识

      使用容器化和 Docker 实现 DevOps 的基础知识 https://www.kubernetes.org.cn/6730.html 2020-02-24 15:20 灵雀云 分类:容器 阅读( ...

    9. Windows Server 2019远程桌面服务配置和授权激活

      参考Windows Server 2016远程桌面服务配置和授权激活方法可适用于Windows Server 2019     Server 2016默认远程桌面连接数是2个用户,如果多余两个用户进行 ...

    随机推荐

    1. BZOJ_4238_电压_树上差分+dfs树

      BZOJ_4238_电压_树上差分+dfs树 Description 你知道Just Odd Inventions社吗?这个公司的业务是“只不过是奇妙的发明(Just Odd Inventions)” ...

    2. Maven安装教程详解

      一.准备工作 1.确定电脑上已经成功安装jdk7.0以上版本                 2.win10操作系统                 3.maven安装包            下载地 ...

    3. 为啥程序会有bug?

      如果这是第二次看到我的文章,欢迎右侧扫码订阅我哟~ 

    4. SpringBoot之旅第二篇-配置

      一.引言 虽然springboot帮我们进行了自动配置,但配置还是不可避免的,比如最简单的端口号,数据库连接.但springboot的配置一般不用xml进行配置,而是yml和properties,选择 ...

    5. SqlServer 将纯数字的时间转换为DateTime

      由于数据库存的是整个字符串组到一起了,C#代码是这个样子的. public static string time(DateTime dt) { ) ? ) ? ) ? ) ? ) ? " + ...

    6. asp.net core系列 44 Web应用 布局

      一.概述 MVC的视图与Razor页面经常共享视觉和程序元素,通过使用布局来完成,布局还可减少重复代码.本章演示了以下内容的操作方法:(1)使用通用布局,(2)自定义布局,(3) 共享指令,(4)在呈 ...

    7. .netcoreapp 发布到 linux 的问题,vs靠不住

      .netcore 2.0 发布后,小版本更新速度惊人 截止目前:2.1.200 最新一个新项目,vs发布到linux@debian9一直报错,反复发布n次依然失败.把本地2.1.100更新到最新2.1 ...

    8. 深入理解令牌认证机制(token)

      以前的开发模式是以MVC为主,但是随着互联网行业快速的发展逐渐的演变成了前后端分离,若项目中需要做登录的话,那么token成为前后端唯一的一个凭证. token即标志.记号的意思,在IT领域也叫作令牌 ...

    9. [Linux] host dig nslookup查询域名的DNS解析

      root@VM-38-204-ubuntu:~# host baidu.com baidu.com has address 220.181.57.216 baidu.com has address 1 ...

    10. Linux安装kubernetes

      使用KUBEADM安装KUBERNETES V1.14.0 一.环境准备      操作系统:Centos 7.5      一台或多台运⾏行行着下列列系统的机器器: ​ Ubuntu 16.04+ ...