Docker keep powershell environment changes Docker keep powershell environment changes powershell powershell

Docker keep powershell environment changes


So,

I have found a workaround for this, basically you want to create a powershell profile at the start of the container, which will get run everytime the RUN command is used..

To do this, I did the following :

RUN mkdir C:\Users\ContainerAdministrator\Documents\WindowsPowerShell ;

RUN New-Item C:\Users\ContainerAdministrator\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 -Type file -Value 'Set-DNSClient -InterfaceIndex 5 -ConnectionSpecificSuffix my.dns.suffix ;'

This will make sure that everytime I run a command it will execute the Set-DNSClient on opening a powershell session.

Hope this helps someone.