Sunday 19 July 2020

Unable to install Powershell modules

Installing powershell modules from powershell gallery on a machine with no direct internet access but which has access via a proxy just needs the proxy url / credentials supplied on the install-module command.

e.g. install-module vmware.vim -proxy http://<proxyip>:<proxy port>

However if you have no repositories registered with Powershell (such as the powershell gallery) you may still see errors relating to the NuGet provider:

NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
 provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\administrator\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?

And when attempting to install nuget, even specifying a proxy you may still get errors because the repository isn't registered.

The solution is to register the default repository via proxy, which will then allow modules to be installed

PS C:\> Get-PSRepository
WARNING: Unable to find module repositories.

PS C:\> Register-PSRepository -Default -Proxy http://<proxy ip>:<proxy port>

PS C:\> Get-PSRepository

Name                      InstallationPolicy   SourceLocation
----                      ------------------   --------------
PSGallery                 Untrusted            https://www.powershellgallery.com/api/v2

You should now be able to install modules via the proxy with the -proxy parameter


Thursday 2 July 2020

Error after docker upgrade: "docker: Error response from daemon: OCI runtime create failed"

After upgrading docker and docker cli (CentOS 7), a previously working container decided to bomb out with the following error: 

docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"write /proc/self/attr/keycreate: permission denied\"": unknown. 

 It turns out that container-selinux also needs to upgraded to match.  

e.g. run yum upgrade docker-ce.x86_64 docker-ce-cli.x86_64 container-selinux