请注意:
C:\> docker run -it mcr.microsoft.com/powershell pwsh
PowerShell 6.2.4
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS /> Get-PSRepository
WARNING: Unable to find module repositories.
PS /> Get-PackageProvider
Name Version DynamicOptions
---- ------- --------------
NuGet 3.0.0.1 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipVali…
PowerShellGet 2.1.3.0 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Fil…
PS /> Register-PSRepository -Default
PS /> Get-PSRepository
WARNING: Unable to find module repositories.
PS /> $env:PSModulePath
/root/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/opt/microsoft/powershell/6/Modules
PS />
Run Code Online (Sandbox Code Playgroud)
所以,没有PS存储库。好的,我运行Register-PSRepository -Default
- 它没有失败。但它也没有任何作用 - 我仍然没有 PS 存储库。
其他人也有同样的问题,但我不明白他们是如何解决的。让我大吃一惊的是,微软的 powershell 映像不起作用。
我错过了什么?
编辑 1
请允许我澄清答案的接受标准。如果您的答案显示了如何跑步docker run -it mcr.microsoft.com/powershell pwsh
,然后Get-PSRepository
- 您达到目标并获得积分。
我遇到了同样的问题,问题是容器已连接到互联网,但没有找到 DNS 地址。如果你运行ping google.com
但不起作用,你也会遇到类似的问题。
修复方法是"dns": ["1.1.1.1"]
在 Docker JSON 配置文件中进行设置,如下所述:无法在 docker windows 容器内访问互联网
归档时间: |
|
查看次数: |
1053 次 |
最近记录: |