Append your self-signed cert to /etc/ssl/certs/ca-certificates.crt
manually.
Assuming you have the self-signed certificate in a file in your build directory called my-cert.pem
:
FROM alpine:latest
COPY my-cert.pem /usr/local/share/ca-certificates/my-cert.crt
RUN cat /usr/local/share/ca-certificates/my-cert.crt >> /etc/ssl/certs/ca-certificates.crt && \
apk --no-cache add \
curl
Note: When you’re using update-ca-certificates
, you need to place your cert file into /usr/local/share/ca-certificates/
first. Otherwise it will be removed from /etc/ssl/certs/ca-certificates.crt
the first time you run update-ca-certificates
.