CircleCI Ideas

Set CA file in setup_remote_docker

I'm using CircleCI 2.0 and I have a private docker registry with self-signed certificate. Using remote docker it would be great if I could set a CA File to docker validate my private repo SSL. When I try to login in Docker registry it's failing with Error response from daemon: Get x509: certificate signed by unknown authority.

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Apr 19 2018
  • Not planned
  • Attach files
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    May 07, 2018 20:57

    You can add the conent of your CA File as an secret environment variable and create an step that get the value of your Environment Variable and put it into the file CA File that you need.
    I have a bash script that is called form a run step an do it. It looks like:

    #!/usr/bin/env bash
    set -e
    echo '-----BEGIN CERTIFICATE-----' > ca.pem && echo $CA_PEM | sed -e 's/\s\+/\n/g' >> ca.pem && echo '-----END CERTIFICATE-----' >> ca.pem