首页 > 解决方案 > 在 Windows 10 Home 上使用 Docker 和 WSL2 运行 eShopOnContainers 时出错:“src_sqldata_1 exited with code 255”

问题描述

当我尝试在 Windows 10 Home 上使用 Docker 和 WSL2 运行eShopOnContainers时,我遇到了这个错误:

src_sqldata_1 exited with code 255

以下是 Docker 中的一些错误消息:

2020-09-30 09:47:22.45 spid3s      Starting up database 'msdb'.

2020-09-30 09:47:22.48 spid3s      Error: 17204, Severity: 16, State: 1.

2020-09-30 09:47:22.48 spid3s      FCB::Open failed: Could not open file d:\dbs\sh\sqfs\0612_201659\cmd\1r\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf for file number 1.  OS error: 2(The system cannot find the file specified.).

2020-09-30 09:47:22.54 spid3s      Error: 5120, Severity: 16, State: 101.

2020-09-30 09:47:22.54 spid3s      Unable to open the physical file "d:\dbs\sh\sqfs\0612_201659\cmd\1r\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf". Operating system error 2: "2(The system cannot find the file specified.)".

2020-09-30 09:47:22.60 spid3s      Error: 17207, Severity: 16, State: 1.

2020-09-30 09:47:22.60 spid3s      FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'd:\dbs\sh\sqfs\0612_201659\cmd\1r\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBLog.ldf'. Diagnose and correct the operating system error, and retry the operation.

2020-09-30 09:47:22.68 spid3s      File activation failure. The physical file name "d:\dbs\sh\sqfs\0612_201659\cmd\1r\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBLog.ldf" may be incorrect.

2020-09-30 09:47:23.96 spid8s      Starting up database 'mssqlsystemresource'.

2020-09-30 09:47:24.01 spid8s      The resource database build version is 14.00.3335. This is an informational message only. No user action is required.

2020-09-30 09:47:24.11 spid8s      Starting up database 'model'.

2020-09-30 09:47:24.13 spid8s      Error: 17204, Severity: 16, State: 1.

2020-09-30 09:47:24.13 spid8s      FCB::Open failed: Could not open file d:\dbs\sh\sqfs\0612_201659\cmd\1r\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\model.mdf for file number 1.  OS error: 2(The system cannot find the file specified.).

正如@mvelosop在这里所建议的那样,我还尝试sqldata使用 仅运行容器,但我得到了同样的错误:docker-compose up sqldata

2020-09-30 12:30:51.53 spid19s     SQL Server is now ready for client connections. This is an informational message; no user action is required.
2020-09-30 12:30:51.60 spid7s      File activation failure. The physical file name "d:\dbs\sh\sqfs\0612_201659\cmd\1r\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\modellog.ldf" may be incorrect.
2020-09-30 12:30:51.64 spid7s      Error: 945, Severity: 14, State: 2.
2020-09-30 12:30:51.64 spid7s      Database 'model' cannot be opened due to inaccessible files or insufficient memory or disk space.  See the SQL Server errorlog for details.
2020-09-30 12:30:51.68 spid7s      SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.
src_sqldata_1 exited with code 255

这是我尝试sqldata仅运行容器时使用的机器资源。

图片

您可以在该图像中看到我还有很多可用的 RAM。

我还剩下很多磁盘空间.. 驱动器 C 和 D 都超过 100GB。

请帮忙。我对 WSL 和 Docker 还不是很熟悉。

太感谢了。

标签: c#.netsql-serverdockerwsl-2

解决方案


我在 docker 中运行 mysql 时遇到了类似的问题。有几点需要考虑:

1. Increase the memory allocation of docker. 
   You can do it easily using docker desktop dashboard.
2. Run the docker-compose with an admin access.
       For an example: sudo docker-compose -f mysql.docker-compose.yml up -d

上面的第 2 点将解决无法访问的文件问题。

以上是我在 MacBook pro 11.5.1 中完成的


推荐阅读