gpt4 book ai didi

Docker 构建失败,出现 'secret pip not found: not found' 错误

转载 作者:行者123 更新时间:2023-12-04 03:37:01 26 4
gpt4 key购买 nike

我正在尝试构建一个 docker 镜像但是正在获取

未找到 secret pip:未找到

对此有什么想法吗?

docker 文件:

FROM <jfrog dockerfile package>
SHELL ["/bin/bash", "-c"]

RUN apt-get update \
&& apt-get -y install chromium chromium-driver
COPY requirments.txt
RUN pip install -r requirments.txt
USER nobody
CMD robot ./smoketests-nonprod.robot \
&& robot ./smoketests-prod.robot

日志如下:

$ docker build -t robottests .
[+] Building 1.6s (18/25)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 39B 0.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 35B 0.0s
=> resolve image config for my-company-docker-virtual.jfrog.io/docker/dockerfile:1.2 0.0s
=> CACHED docker-image://my-company-docker-virtual.jfrog.io/docker/dockerfile:1.2 0.0s
=> [internal] load metadata for my-company-docker-virtual.jfrog.io/node:14-buster-slim 0.0s
=> [internal] load metadata for my-company-docker-virtual.jfrog.io/python:3-slim 0.0s
=> [base 1/7] FROM my-company-docker-virtual.jfrog.io/python:3-slim 0.0s
=> [client 1/6] FROM my-company-docker-virtual.jfrog.io/node:14-buster-slim 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 5.25kB 0.0s
=> CACHED [base 2/7] RUN echo 'APT { Default-Release "stable"; };' >/etc/apt/apt.conf && echo deb http://deb.debian.org/debian testing main >>/etc/apt/sources.list 0.0s
=> CACHED [base 3/7] RUN --mount=type=cache,target=/var/cache/apt --mount=type=secret,id=sources.list,target=/etc/apt/sources.list,required=true apt update && apt -y install libcap2-bin/testing 0.0s
=> CACHED [base 4/7] RUN ["/sbin/setcap", "cap_net_bind_service,cap_setpcap+p", "/sbin/capsh"] 0.0s
=> CACHED [base 5/7] WORKDIR /project 0.0s
=> CACHED [base 6/7] COPY pyproject.toml setup.* . 0.0s
=> CACHED [client 2/6] WORKDIR /client 0.0s
=> CACHED [client 3/6] COPY package*.json . 0.0s
=> ERROR [base 7/7] RUN --mount=type=cache,target=/root/.cache --mount=type=secret,id=pip,target=/etc/pip.conf,required=true mkdir -p src && pip install -U pip wheel && pip install . && pip unin 0.1s
=> CANCELED [client 4/6] RUN --mount=type=secret,id=npmrc,target=/usr/local/etc/npmrc,required=true --mount=type=bind,source=.npmrc,target=/root/.npmrc --mount=type=cache,target=/root/.npm npm c 0.2s
------
> [base 7/7] RUN --mount=type=cache,target=/root/.cache --mount=type=secret,id=pip,target=/etc/pip.conf,required=true mkdir -p src && pip install -U pip wheel && pip install . && pip uninstall -y $(./setup.py --name):
------
secret pip not found: not found

任何帮助将不胜感激

最佳答案

这是使用 relatively new --secret option这允许您在构建时安装 secret

你使用它的一般方式是你在外面有一个 secret 文件并给它分配一个id

在你的情况下,你会在某处有一个 pip.conf 文件并在你的构建命令中指定它:

docker build --secret id=pip,src=pip.conf -t robottests .

这将使 pip.conf 在构建期间可用,但不是图像的一部分(可能是因为它包含用于访问内部 pypi 的身份验证 secret )

关于Docker 构建失败,出现 'secret pip not found: not found' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66695571/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com