Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mounting ISO images with powershell inside windowsservercore fails

I am trying to perform an unattended install of SQL Server on Windows Server Core in Docker. But it throws this error: A virtual disk support provider for the specified file was not found.

Does anybody know how to make Mount-DiskImage work on Windows Server Core?

RUN @echo off && `
    aws s3 cp s3://mybucket/en_sql_server_2016_developer_with_service_pack_1_x64_dvd_9548071.iso C:\en_sql_server_2016_developer_with_service_pack_1_x64_dvd_9548071.iso && `
    for /f "delims=" %%A in ('@powershell -NoProfile -ExecutionPolicy Bypass -Command "(Mount-DiskImage -ImagePath C:\en_sql_server_2016_developer_with_service_pack_1_x64_dvd_9548071.iso -PassThru | Get-Volume).DriveLetter"') do set "ISO_DRIVE_LETTER=%%A" && `
    echo Mounted SQL install image to drive %ISO_DRIVE_LETTER% && `
    echo Setting up SQL Server.. && `
%ISO_DRIVE_LETTER%:\Setup /ConfigurationFile=SQLInstallConfig.ini

P.S.: I have tried to copy the ISO image directly onto the docker container and got the same result. So it doesn't seem to be a corrupted image.

like image 967
Kyryll Tenin Baum Avatar asked Dec 08 '16 06:12

Kyryll Tenin Baum


1 Answers

As of August 2021 this is still not possible to mount disk images within a Windows Docker container. I've tried resolving this myself enough times, the furthest I've gotten is a vague mention of a "missing virtual DVD feature", though I can't find any features mentioning "virtual DVDs" or mentioning mounting images.


As a workaround, you can either extract the disk image/ISO to a folder or mount the image within the host. Then expose the directory path to the container.


Neither of these are perfect solutions when scripts or packages you don't maintain might attempt to download and mount a disk image/ISO as part of its own setup process. However, software installers or packages which do want a disk image as an external source oftentimes provide a parameter to specify an alternative installation source location so you may be able to find a suitable workaround in these scenarios.

like image 91
Bender the Greatest Avatar answered Oct 21 '22 02:10

Bender the Greatest