zoukankan      html  css  js  c++  java
  • 在 Windows Server 2019 上运行 dapr 遇到的 docker 问题

    在 Windows Server 2019 上安装 dapr ,安装成功后有一段提示文字

    Ensure that Docker Desktop is set to Linux containers mode when you run Dapr in self hosted mode.

    开始时没注意到这个提示,然后安装 docker engine

    Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
    Install-Package -Name docker -ProviderName DockerMsftProvider
    

    接着运行 dapr init ,报下面的错误

    docker: no matching manifest for windows/amd64 10.0.17763 in the manifest list entries.

    查找资料后得知 docker engine 默认是 Windows container 模式,解决上面的错误需要切换到 Linux container 模式,这时才注意到安装 dapr 时的提示。

    通过 docker desktop 切换到 Linux container 模式,但 docker engine 总是启动失败,报错如下:

    The Virtual Machine Management Service failed to start the virtual machine 'DockerDesktopVM' because one of the Hyper-V components is not running

    折腾一阵,没有解决,后来通过 Run Docker Containers on Windows Server 2019 知道原来需要安装 preview 版 Docker EE。

    通过下面的一系列 powershell 命令安装 preview 版 Docker EE 之后,支持 Linux container 模式终于成功启动。

    Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
    
    Uninstall-Package -Name docker -ProviderName DockerMSFTProvider
    Install-Module DockerProvider
    Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview
    Restart-Computer -Force
    [Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")
    Restart-Service docker
    

    但是运行 dapr init 出现新的错误

    docker: failed to register layer: failed to start service utility VM (applydiff 88e57cc977280a42ef93829fad29a6ffbe1be1320278764f77575546056c1800): container 88e57cc977280a42ef93829fad29a6ffbe1be1320278764f77575546056c1800_svm encountered an error during CreateContainer: failure in a Windows system call: The virtual machine could not be started because a required feature is not installed. (0xc0370102) extra info: {"SystemType":"container","Name":"88e57cc977280a42ef93829fad29a6ffbe1be1320278764f77575546056c1800_svm","Layers":null,"HvPartition":true,"HvRuntime":{"ImagePath":"C:\Program Files\Linux Containers","LinuxInitrdFile":"initrd.img","LinuxKernelFile":"bootx64.efi"},"ContainerType":"linux","TerminateOnLastHandleClosed":true}.

    运行 ubuntu 容器也是同样的错误

    docker run -it --rm ubuntu /bin/bash
    

    又折腾一阵,通过 Azure VM Docker CreateContainer Error (0xc0370102) 知道原来需要云服务器支持 Nested Virtualization,看来当前使用的百度云服务器不支持。

    换到阿里云试试,阿里云提供了专门的“Windows Server 2019 with Container 数据中心版”镜像,用这个镜像也未能成功运行 Linux container。

    网上查了一下,目前好像只有微软的 azure 与 google 的 gcd 支持 Nested Virtualization。

  • 相关阅读:
    云时代架构阅读笔记时十
    云时代架构”经典文章阅读感想九
    “云时代架构”经典文章阅读感想八
    antlr4
    Centos7定时脚本
    JDBC连接hive失败,一种原因的解决方法
    Linux实用操作命令
    secureCRT下载虚拟机文件到本地
    OpenFeign执行POST请求类型以及Python的requests.post()方法
    DataSphere安装配置
  • 原文地址:https://www.cnblogs.com/dudu/p/15573090.html
Copyright © 2011-2022 走看看