I'm trying to install Anaconda distribution on Windows docker based nano-server.
This is my dockerfile (based on 4 yeras old example I found in GitHub)
# escape= `
# Use the latest Windows Server Core 2022 image.
FROM mcr.microsoft.com/windows/servercore:ltsc2022 AS base
RUN powershell (New-Object System.Net.WebClient).DownloadFile('https://repo.anaconda.com/archive/Anaconda3-2022.05-Windows-x86_64.exe', 'Anaconda3.exe')
RUN powershell Unblock-File -Path Anaconda3.exe
RUN Anaconda3.exe /InstallationType=JustMe /RegisterPython=1 /S /D=C:\Python
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022-amd64
COPY --from=base C:\Python C:\Python
ENV PATH="C:\Python;C:\Python\Library\mingw-w64\bin;C:\Python\Library\usr\bin;C:\Python\Library\bin;C:\Python\Scripts;C:\Python\bin;C:\Python\condabin;C:\Windows;C:\Windows\System32;"
CMD ["cmd"]
The docker looks ok, I can launch Python, but once I try to import numpy or sklearn I got errors (fail to load some DLLs). I could make numpy work by reinstalling it (pip install --force-reinstall numpy), but this workaround didn't work for other libraries. I also tried to install only Miniconda, then use conda install to add libraries, but trying to run conda in the nanoserver fails (pythoncom error: coinitializeex failed).
Trying a similar docker but on top of server core (servercore:ltsc2022) works flawlessly.
The reason I struggle to use Anaconda on nanoserver is to minimize its size - the docker size of the container based on servercore adds ~7GB to the size on the nanoserver.
Is it possible to run Anaconda on nano-server?
thanks, Adi