How to execute some process in Dockerfile

Hello everybody,

today I want to share another piece of code, that proved to be helpful for me in creating docker containers.

Here it is:

Start-Process c:\sdksetup.exe -ArgumentList '/Quiet /NoRestart' -Wait; \

First time when I seen it I was sceptical. Why I should use Start-Process instead of just running application? The answer is simple: because quite often installers just execute some processes and give control to powershell in asyncronous way. And if other parts of your docker image are dependable from your sdksetup.exe, then you'll not get needed container.

For example you can install Dot net 4.6.2 package in the following way:

RUN Invoke-WebRequest 'https://download.microsoft.com/download/E/F/D/EFD52638-B804-4865-BB57-47F4B9C80269/NDP462-DevPack-KB3151934-ENU.exe' -OutFile 'NDP462-DevPack-KB3151934-ENU.exe';\
        Start-Process 'c:\NDP462-DevPack-KB3151934-ENU.exe' -ArgumentList '/Quiet /NoRestart' -Wait; \
        Remove-Item 'c:\NDP462-DevPack-KB3151934-ENU.exe'

Another question that you can ask, why not to use chocolatey? Hm. You can try to achieve it with chocolatey and you will find that for now chocolatey can't install Dot net 4.6.2 package for some reasons mentioned in log file.

No Comments

Add a Comment