Dockerfile of an image that is based on
node:12 I have the following lines to add a self signed certificate
RUN apt-get update && apt-get -yqq install ca-certificates RUN mkdir -p /usr/local/share/ca-certificates/domain COPY .docker/cert.crt /usr/local/share/ca-certificates/domain/ RUN update-ca-certificates --fresh RUN yarn config set cafile /usr/local/share/ca-certificates/domain/cert.crt
When I also add
RUN yarn config list I can see that this setting has been added successfully. Afterwards, I built and pushed my image to the registry.
However now, when I use it in my
.gitlab-ci.yml and use
yarn install I get an error that there’s a self-signed certificate in the chain.
When I use
yarn config list inside the pipeline, it doesn’t show the
cafile as if the settings set in the image are not used.
When I add
yarn config set cafile /usr/local/share/ca-certificates/domain/cert.crt to the
script part of my pipeline it works without problems which means
- That my image is built correctly, since it has the cert at the right location and it works if added manually
- That somehow the config is not persisted from the image to the pipeline
I checked the
Dockerfile https://github.com/nodejs/docker-node/blob/master/12/stretch/Dockerfile and there’s no user set which could mean that it runs under different users, does it?
Why does it not work when adding the cert in the image already?
Source: Docker Questions