升级到WSL2后映射卷时,MSSQL容器无法启动



在我将Docker Desktop更改为使用WSL2后,我无法使用Docker compose启动mssql映像。

如果我不映射卷,容器就会启动。

Docker撰写

services:
db:
image: "mcr.microsoft.com/mssql/server:2019-latest"
container_name: mssql
environment:
SA_PASSWORD: "***********"
ACCEPT_EULA: "Y"
ports:
- 1433:1433
volumes:
- ~/docker/sql/mssql/:/var/opt/mssql/
- ~/docker/sql/sqlserver/:/var/opt/sqlserver/
healthcheck:
test: /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$$SA_PASSWORD" -Q "SELECT 1" || exit 1
interval: 30s
timeout: 30s
retries: 3

错误

** ERROR: [AppLoader] Failed to load LSA: 0xc0070102
AppLoader: Exiting with status=0xc0070102
This program has encountered a fatal error and cannot continue running at Tue Dec 15 13:49:34 2020
The following diagnostic information is available:
Reason: 0x00000006
Message: Termination of SystemRootsystem32AppLoader.exe was due to fatal error 0xC0000001
Address: 0x3fffb0c551f1
Stack Trace:
file://package4/windows/system32/sqlpal.dll+0x000000000030E7D9
file://package4/windows/system32/sqlpal.dll+0x000000000030C769
file://package4/windows/system32/sqlpal.dll+0x0000000000255F1D
file://package4/windows/system32/sqlpal.dll+0x00000000002551F1
file://package4/windows/system32/sqlpal.dll+0x0000000000254A72
file://package4/windows/system32/sqlpal.dll+0x0000000000254B4B
file://package4/windows/system32/sqlpal.dll+0x0000000000202FE2
file://package4/windows/system32/sqlpal.dll+0x0000000000347898
file:///windows/system32/AppLoader.exe+0x0000000000003C90
file:///Windows/SYSTEM32/KERNEL32.DLL+0x0000000000014414
file:///windows/system32/ntdll.dll+0x0000000000075541
<unknown>+0x00000000FC3FE000
Process: 10 - sqlservr
Thread: 39 (application thread 0x68)
Instance Id: 7cfc9545-c829-4a7e-a461-83b481fe05e3
Crash Id: b747c621-d4e2-46ed-9122-f14a8d54386a
Build stamp: fd4eb1565f159d8f4b2d49c48e96d5797508c8bc5f222def3def149a28435962
Distribution: Ubuntu 18.04.5 LTS
Processors: 8
Total Memory: 13339308032 bytes
Timestamp: Tue Dec 15 13:49:34 2020
Ubuntu 18.04.5 LTS
Capturing core dump and information to /var/opt/mssql/log...
/bin/cat: /proc/10/maps: Permission denied
/bin/cat: /proc/10/environ: Permission denied
/usr/bin/find: '/proc/10/map_files': Permission denied
/usr/bin/find: '/proc/10/map_files': Permission denied
/usr/bin/find: '/proc/10/map_files': Permission denied
/usr/bin/find: '/proc/10/map_files': Permission denied
dmesg: read kernel buffer failed: Operation not permitted
/usr/bin/timeout: failed to run command '/bin/journalctl': No such file or directory
/usr/bin/timeout: failed to run command '/bin/journalctl': No such file or directory
Tue Dec 15 13:49:36 UTC 2020 Capturing program information
Tue Dec 15 13:49:36 UTC 2020 Attempting to capture a dump with paldumper for pid 10
WARNING: Capture attempt failure detected
Attempting to capture a filtered dump with paldumper for pid 10
WARNING: Attempt to capture dump failed. Reference /var/opt/mssql/log/core.sqlservr.10.temp/log/paldumper-debug.log for details
Tue Dec 15 13:49:36 UTC 2020 Attempting to capture a dump with gdb
Tue Dec 15 13:49:36 UTC 2020 Captured a dump with gdb
Tue Dec 15 13:49:36 UTC 2020 Capturing program binaries
Tue Dec 15 13:49:36 UTC 2020 Compressing the dump files

wsl--列表--详细

NAME                   STATE           VERSION
* Ubuntu-20.04           Running         2
docker-desktop         Running         2
docker-desktop-data    Running         2

正如文档所述,整个/var/opt/mssql文件夹无法映射,但您可能想要映射数据子目录/var/opt/mscql/data,它保存数据库文件,您可以在没有任何问题的情况下映射这些文件

。。。Windows上Docker的主机卷映射当前不支持映射完整的/var/opt/mssql目录。但是,您可以将子目录(如/var/opt/mssql/data(映射到您的主机。。。

这似乎是权限问题。我遇到过类似的问题,MS SQL容器无法启动并不断崩溃。通过添加user: root,使容器以root权限运行服务器的用户,解决了这个问题。你试过这个吗?

services:
db:
image: "mcr.microsoft.com/mssql/server:2019-latest"
container_name: mssql
user: root
environment:
SA_PASSWORD: "***********"
ACCEPT_EULA: "Y"
ports:
- 1433:1433
volumes:
- ~/docker/sql/mssql/:/var/opt/mssql/
- ~/docker/sql/sqlserver/:/var/opt/sqlserver/
healthcheck:
test: /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$$SA_PASSWORD" -Q "SELECT 1" || exit 1
interval: 30s
timeout: 30s
retries: 3

PS:有些人在以root用户身份运行服务器时可能存在安全问题。如果你知道如何处理这个问题,请参与进来,尽管微软似乎接受了root特权。

相关内容

  • 没有找到相关文章

最新更新