Docker Windows 的 Deskop 2.3.0.2 - 主机卷停止工作

Docker Deskop 2.3.0.2 for Windows - Host Volumes Stopped Working

我有一个 compose (yml) 文件,可以根据需要启动和关闭服务器。我刚刚将 Windows 上的 Docker 桌面更新到版本 2.3.0.2。

我的 Sql 服务器实例现在不会停留 运行ning。

我的 yaml 文件很简单:

 version: '3.2'

services:  
  dev-mssql-server:
    image: mcr.microsoft.com/mssql/server
    container_name: dev-mssql-server
    volumes:
      - type: bind
        source: C:\Data\sqlserver-linux-container
        target: /var/opt/mssql/data
    networks:
      dvlpnet:
        ipv4_address:  172.22.0.20
    environment:
      - ACCEPT_EULA=Y
      - SA_PASSWORD=ReallyBitchin#1Password
      - MSSQL_PID=Developer
    ports:
      - "15785:1433"

networks:
  dvlpnet:
    ipam:
      config:
        - subnet:  172.22.0.0/24

volumes:
  sqlserver-linux-container:

来自 Docker 仪表板的消息是:

Attaching to dev-mssql-server
dev-mssql-server | SQL Server 2019 will run as non-root by default.
dev-mssql-server | This container is running as user mssql.
dev-mssql-server | Your master database file is owned by root.
dev-mssql-server | To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
dev-mssql-server | 2020-05-18 18:25:20.88 Server Setup step is FORCE copying system data file 'C:\templatedata\model_replicatedmaster.mdf' to '/var/opt/mssql/data/model_replicatedmaster.mdf'.
2020-05-18 18:25:21.13 Server ERROR: Setup FAILED copying system data file 'C:\templatedata\model_replicatedmaster.mdf' to '/var/opt/mssql/data/model_replicatedmaster.mdf': 1(Incorrect function.)
dev-mssql-server | ERROR: BootstrapSystemDataDirectories() failure (HRESULT 0x80070001)
dev-mssql-server exited with code 1

一些 Docker 日志文件在这里:

[13:26:48.754][GoBackendProcess  ][Info   ] stopping accepting connections on docker-proxy-port-approver/approver-6129484611666145821 tcp forward from 0.0.0.0:15785 to 0.0.0.0:0
[13:26:48.754][GoBackendProcess  ][Error  ] wsl unexpose error:Post http://unix/forwards/unexpose/port: open \\.\pipe\dockerWsl2BootstrapExposePorts: The system cannot find the file specified.
[13:26:48.754][GoBackendProcess  ][Info   ] external: POST /forwards/unexpose/port 200 \"Go-http-client/1.1\" \"\
[13:26:49.255][ApiProxy          ][Info   ] proxy << POST /v1.25/containers/ab6315ce510c8143da6760f54425ba625a2acffb5e6fb387ca3120b992b7aef6/start (515.4339ms)\n
[13:26:49.257][GoBackendProcess  ][Info   ] vpnkitExposer.Add(ab6315ce510c8143da6760f54425ba625a2acffb5e6fb387ca3120b992b7aef6, [TCP 0.0.0.0:15785 -> 127.0.0.1:15785])
[13:26:49.257][GoBackendProcess  ][Info   ] adding docker-containers/ab6315ce510c8143da6760f54425ba625a2acffb5e6fb387ca3120b992b7aef6 tcp forward from 0.0.0.0:15785 to 127.0.0.1:15785
[13:26:49.258][GoBackendProcess  ][Error  ] wsl expose error:Post http://unix/forwards/expose/port: open \\.\pipe\dockerWsl2BootstrapExposePorts: The system cannot find the file specified.
[13:26:49.260][GoBackendProcess  ][Info   ] grpcfuseSharer.Add(ab6315ce510c8143da6760f54425ba625a2acffb5e6fb387ca3120b992b7aef6, [src=C:\Data\sqlserver-linux-container,dst=/var/opt/mssql/data,option=rw])
[13:26:49.260][GoBackendProcess  ][Info   ] lazily recomputing file watches
[13:26:49.260][GoBackendProcess  ][Info   ] watching path C:\Data\sqlserver-linux-container\
[13:26:49.260][GoBackendProcess  ][Info   ] invalidating caches for C:\Data\sqlserver-linux-container\
[13:26:49.261][ApiProxy          ][Info   ] proxy >> GET /containers/ab6315ce510c8143da6760f54425ba625a2acffb5e6fb387ca3120b992b7aef6/json\n
[13:26:49.266][ApiProxy          ][Info   ] proxy << GET /containers/ab6315ce510c8143da6760f54425ba625a2acffb5e6fb387ca3120b992b7aef6/json (5.0047ms)\n
[13:26:49.269][GoBackendProcess  ][Info   ] caches invalidated for C:\Data\sqlserver-linux-container\

我确保我的 C 盘在新版本的 Docker 桌面中仍然正确共享。在我开始看到这些错误后,我什至多余地添加了 c:\data 和 c:\data\sqlserver-linux-container 共享目录。

我无法在 interwebbies 上找到很多关于 Docker 桌面如何处理 Windows 主机卷的新版本。

我删除了版本 2.3.0.2 并重新安装了旧版本 2.2.0.5,一切又恢复正常了。

有没有人运行参与其中?有没有我找不到的解决方案?

我们有同样的问题。我们的侦察表明:

  • Docker 桌面版 2.3.0.2(更新日志)

Docker Desktop now allows sharing individual folders, rather than whole drives, giving more control to users over what is being shared.

  • 微软建议单独映射子目录:

https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-docker?view=sql-server-ver15#mount-a-host-directory-as-data-volume

      mssql:
        container_name:  $PROJECTNAME-mssql
        restart: ${DOCKER_RESTART}
        image: "mcr.microsoft.com/mssql/server:2019-CU4-ubuntu-16.04"
        volumes:
          # konfiguracja dla lokalnej bazy mssql na dockerze
          - ./var/data/mssql/data:/var/opt/mssql/data
          - ./var/data/mssql/log:/var/opt/mssql/log
          - ./var/data/mssql/secrets:/var/opt/mssql/secrets

还是不行。

编辑:

在 github 上注册了一个与此相关的活跃问题:

https://github.com/docker/for-win/issues/6646