我正在尝试创建一个Docker容器以在云中运行我的PowerShell Core代码。
无论我使用来自Docker Hub的microsoft / powershell基础映像还是ubuntu映像并遵循PowerShell Core安装说明(https://docs.microsoft.com/en-au/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-6#ubuntu-1804-都可以运行pwsh),
我最终没有PSGallery可用。我尝试注册默认PSRepository的尝试不会产生错误,但没有任何区别:
PS /> Get-PSRepository
WARNING: Unable to find module repositories.
PS /> Register-PSRepository -Default -Proxy $myproxy
PS /> Get-PSRepository
WARNING: Unable to find module repositories.
当我尝试使用非默认名称注册存储库时,收到其他错误:
PS /> Register-PSRepository -Name Gallery -SourceLocation https://www.powershellgallery.com/api/v2/
Register-PSRepository:参数'SourceLocation'的指定Uri'https://www.powershellgallery.com/api/v2/'是无效的Web Uri。请确保它符合Web Uri要求。
我想进入一个阶段,在构建映像时可以访问PowerShell画廊,以直接添加模块。我要运行什么命令才能在香草pwsh安装上启用图库?
我相信有一个解决方法-将模块文件复制到$ env:PSModulePath中的一个文件夹中,但要寻找引起原始问题的原因。