我正在Windows容器中部署mysql服务器。当绑定安装mysql的数据目录时,遇到一些错误。
码头工人信息如下:
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 15
Server Version: 18.09.2
Storage Driver: lcow (linux) windowsfilter (windows)
LCOW:
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: ics l2bridge l2tunnel nat null overlay transparent
Log: awslogs etwlogs fluentd gelf json-file local logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 17134 (17134.1.amd64fre.rs4_release.180410-1804)
Operating System: Windows 10 Pro Version 1803 (OS Build 17134.472)
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 7.927GiB
Name: 1512010NB01
ID: CX5Q:ZLPK:H23T:KKXB:7P5I:7JY3:R5RO:CKFL:3ZRT:KNZ5:AJGW:V35W
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: -1
Goroutines: 30
System Time: 2019-06-26T11:11:55.1161658+08:00
EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
docker版本如下:
Client: Docker Engine - Community
Version: 18.09.2
API version: 1.39
Go version: go1.10.8
Git commit: 6247962
Built: Sun Feb 10 04:12:31 2019
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.2
API version: 1.39 (minimum version 1.24)
Go version: go1.10.6
Git commit: 6247962
Built: Sun Feb 10 04:28:48 2019
OS/Arch: windows/amd64
Experimental: true
bellow是我的docker文件
FROM microsoft/windowsservercore:1803
LABEL Author="aa@bb.cc.dd" MySQLVersion="8.0.13"
RUN powershell -Command \
Invoke-WebRequest -UseBasicParsing -Uri "https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x64.exe" -OutFile "C:\vc_redist.x64.exe"; \
[Net.ServicePointManager]::SecurityProtocol='tls12,tls11,tls'; \
Invoke-WebRequest -UseBasicParsing -Uri "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.13-winx64.zip" -OutFile "C:\MySQL.zip"; \
&& vc_redist.x64.exe /install /passive /norestart /quiet \
&& powershell -command \
Expand-Archive -Path c:\mysql.zip -DestinationPath C:\ ; \
ren C:\mysql-8.0.13-winx64 C:\MySQL ; \
Remove-Item c:\MySQL.zip -Force; \
Remove-Item c:\vc_redist.x64.exe; \
&& powershell -f InitMySql.ps1 \
&& powershell -command Remove-Item c:\InitMySql.ps1 -Force; \
&& setx PATH /M %PATH%;C:\MySQL\bin
EXPOSE 3306/tcp
ENTRYPOINT ["powershell.exe", "C:\\MySQL\\bin\\mysqld.exe", "--console"]
构建图像并执行
docker run -it --name testmysql --mount type = bind,src = c:\ backup,dst = C:\ MySQL \ data xxxx / mysqlforwindows:latest
一些错误发生如下:
[系统] [MY-010116] [服务器] C:\ MySQL \ bin \ mysqld.exe(mysqld 8.0.13)作为进程1324开始 [错误] [MY-011011] [服务器]无法找到有效的数据目录。 [错误] [MY-010020] [服务器]数据字典初始化失败。 [错误] [MY-010119] [服务器]正在中止 [系统] [MY-010910] [服务器] C:\ MySQL \ bin \ mysqld.exe:关闭完成(mysqld 8.0.13)MySQL Community Server-GPL。
mysql文档中有一些建议,该错误可能是由套接字文件引起的,但是我不知道如何解决它。
https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/deploy-mysql-nonlinux-docker.html
如何解决问题,有人建议吗?谢谢。