Docker Community Forums

Share and learn in the Docker community.

Not working when i register DLL with regsvr32 inside docker container

Please help how to register dll using docker file and also how to check registered dll files

I think you need to explain much more clearly what you are trying to achieve.

What have you tried, what were the results of those attempts ?

Thanks for your response.
I am using docker on windows 10 pro. I am trying to register COM dll.
Below is my docker file.

FROM microsoft/iis
SHELL ["powershell","-command"]

RUN New-Item -Path $env:systemdrive\inetpub\XpServerDllFiles -Type Directory
COPY ./my.dll /inetpub/XpServerDllFiles
RUN Start-Process C:\Windows\SysWOW64\regsvr32.exe C:/inetpub/XpServerDllFiles/my.dll


Dll is copied inside the container. All the paths are correct.
Addition to this I’ve also tried running same Start-process command in powershell in docker container. I’ve also created an admin user and Start-process command with -Credential flag. None of these seems to work. I’ve checked the registry. No entry is found there and my application is also not running which is dependent on my.dll.

Hey! Were you able to workaround this issue? I’m facing the same problem.

For now, I registered the DLL in my machine (not docker) then exported the registries from HKCR to a .reg file. After that I moved the .reg to container and ran it there. After that the application worked fine…
That solution is far from ideal!

Can you elaborate your workaround about using the exported .reg files? Did you have to do anything apart from importing the .reg file inside the container?

Not a problem.
So for example I had a dll called test.dll exposing a namespace called Hello and class World.

  1. Register test.dll using regsvr32 command like you normally do in your dev machine. Regsvr32 creates registries on HKEY_CLASSES_ROOT
  2. Then go to HKEY_CLASSES_ROOT and search for Hello.World. Right click Hello.World and export registries
  3. Inside Hello.World there is a CLSID key with a default value (guid). Get that value and search inside your registry.
  4. You should find this key under same hive or WOW6432Node. Export that registry too.
  5. Now you have two .reg files, you can merge them and copy that to your container
  6. Make sure you have RUN “reg import yourfile.reg” in your dockerfile!

That should be it. The only point of attention here is that if your dll has code in DllRegisterServer function, you wouldn’t be executing it.