小编Dan*_*iel的帖子

Docker 中的 NuGet:错误 NU1301:无法加载源的服务索引 - 序列不包含任何元素

我正在尝试在 Docker (Linux) 上为企业代理后面的 .NET 6 应用程序下载 NuGet 包

ARG netVersion=6.0

FROM mcr.microsoft.com/dotnet/sdk:${netVersion} AS build-env
WORKDIR /app

COPY company-root-ca.crt /usr/local/share/ca-certificates/company-root-ca.crt
RUN update-ca-certificates

COPY App/*.csproj .
RUN dotnet restore --configfile nuget.config
Run Code Online (Sandbox Code Playgroud)

调用dotnet restore失败:

#17 [build-env 10/18] RUN dotnet restore --configfile nuget.config
#17 1.083   Determining projects to restore...
#17 6.883 /app/MyApp.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json.
#17 6.900 /usr/share/dotnet/sdk/6.0.301/NuGet.targets(130,5): error : Sequence contains no elements [/app/MyApp.csproj]
#17 ERROR: executor failed running [/bin/sh -c …
Run Code Online (Sandbox Code Playgroud)

.net asp.net docker dockerfile

11
推荐指数
1
解决办法
3万
查看次数

使用 dotnet 恢复的 Docker 会导致错误:GSSAPI 操作失败 - 请求了不受支持的机制

拥有 ASP.NET Core 2.2 Web 应用程序,我尝试在合作代理后面恢复 NuGet 包

FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS sdk-image
WORKDIR /app/
ARG HTTP_PROXY
ENV HTTP_PROXY ${HTTP_PROXY}
ENV HTTPS_PROXY ${HTTP_PROXY}
COPY MyProject.csproj .

RUN dotnet restore
Run Code Online (Sandbox Code Playgroud)

具有以下内容docker-compose.yml

version: '2'
services:
  tool:
    build:
      context: .
      args:
        http_proxy: ${HTTP_PROXY}
networks:
  default:
    ipam:
      driver: default
      config:
        - subnet: 192.168.239.0/21
Run Code Online (Sandbox Code Playgroud)

由于 Docker 的默认网络与内部公司范围冲突,网络被覆盖。HTTP_PROXY在主机上设置为完整的 url,例如http://user:password@proxy.internal:81.

运行时docker-compose up --build恢复失败:

Step 7/15 : RUN dotnet restore
 ---> Running in 62c8bb6f2f72
/usr/share/dotnet/sdk/2.2.402/NuGet.targets(123,5): error : Unable to load the …
Run Code Online (Sandbox Code Playgroud)

c# nuget docker asp.net-core asp.net-core-2.2

4
推荐指数
1
解决办法
1万
查看次数

使用ansible的helm扩展覆盖values.yml

我想创建一个剧本来安装 IBM ZIP 存档提供的外部 helm 图表。我们需要用自定义值覆盖values.yml中的一些值(例如主机到docker注册表)。

IBM value.yml 中的示例

image:
  pullPolicy: IfNotPresent
  repository: artifactory.swg.usma.ibm.com:6562
Run Code Online (Sandbox Code Playgroud)

由于 IBM 设置了非公共存储库,因此我将图像(从 IBM 版本下载)上传到我的自定义注册表registry.example.com,并希望将其设置在我的剧本中:

- name: CNX Bootstrap
  helm:
    # Port forwarding from tiller to localhost
    host: localhost
    state: present
    name: bootstrap-test
    namespace: "{{namespace}}"
    chart: 
      name: bootstrap
      source:
        type: directory
        location: /install/component-pack/IC-ComponentPack-6.0.0.7/microservices_connections/hybridcloud/helmbuilds/bootstrap
    values: 
      image.repository: "registry.example.com"
Run Code Online (Sandbox Code Playgroud)

这不起作用,pod 日志显示:

无法拉取映像“artifactory.swg.usma.ibm.com:6562/bootstrap:20190204-022029”:rpc 错误:代码 = 未知 desc = 获取https://artifactory.swg.usma.ibm.com:6562/v1 /_ping : 服务不可用

所以它仍然使用错误的注册表,并且我的自定义values似乎被忽略。使用helmcli,我可以使用--set如下开关进行覆盖:

helm install --name=bootstrap /install/component-pack/IC-ComponentPack-6.0.0.7/microservices_connections/hybridcloud/helmbuilds/bootstrap-0.1.0-20190204-022029.tgz --set image.repository=registry.example.com
Run Code Online (Sandbox Code Playgroud)

如何像--set …

ibm-connections ansible docker kubernetes-helm

3
推荐指数
1
解决办法
4469
查看次数