skip to Main Content

I am trying to build a docker image but getting

secret pip not found: not found

Any ideas on this?

Dockerfile:

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 

The log is as follows:

$ 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

Any help would be appreciated

2

Answers


  1. This is using the relatively new –secret option which allows you to mount secrets at build time

    The general way you utilize it is you have a secret file outside and assign it an id

    in your case, you’d have a pip.conf file somewhere and specify it in your build command:

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

    this will make the pip.conf available during the build, but not part of your image (presumably because it contains authentication secrets for accessing your internal pypi)

    Login or Signup to reply.
  2. Maybe I’m wrong, but for me you do not show the Dockerfile corresponding to the logs. Or there are some missing parts which could have been helpful.
    I’d expect to view something like that in your Dockerfile which is in error :

    RUN ["/sbin/setcap", "cap_net_bind_service,cap_setpcap+p", "/sbin/capsh"]
    WORKDIR /project
    COPY pyproject.toml setup.* .
    WORKDIR /client
    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...
    

    Because in this last line, there is the part that fails :
    --mount=type=secret,id=pip,target=/etc/pip.conf,required=true
    And with the link provided by Anthony Sottile, or this link I think you can be able to find out what is wrong in your command.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search