Building Docker Image For MySql 8.0.11 From Microsoft/Windowsservercore Base Image

· Read in about 1 min · (140 words) ·

I wanted to setup a testing docker image for .NET and MySql 8.0.11. Unfortunatelly it didn’t work out of the box but I found it pretty easily that the missing dependency on the image is Microsoft Visual C++ 2015 Redistributable Update 3.

Below is Dockerfile I used to build the image.

Into the same directory put download 8.0.11 Mysql server version https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-winx64.zip named as mysql.zip.

Please note that the image below is created with root user without a password specified

FROM microsoft/windowsservercore

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

COPY mysql.zip c:\\mysql.zip

RUN Expand-Archive c:/mysql.zip -DestinationPath C:/ ; \
    Remove-Item c:/mysql.zip

RUN $env:PATH = 'C:\\mysql-8.0.11-winx64\\bin\\;' + $env:PATH; \
    [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine);

RUN Invoke-WebRequest 'https://download.microsoft.com/download/6/D/F/6DF3FF94-F7F9-4F0B-838C-A328D1A7D0EE/vc_redist.x64.exe' -OutFile vcredist_x64.exe ; \
    Start-Process vcredist_x64.exe -ArgumentList '/install', '/passive', '/norestart' -NoNewWindow -Wait ; \
    Remove-Item vcredist_x64.exe

RUN C:\\mysql-8.0.11-winx64\\bin\\mysqld --initialize-insecure
RUN C:\\mysql-8.0.11-winx64\\bin\\mysqld --install


ENTRYPOINT ["cmd.exe"]