Passing Git SSH key from CircleCI down to Docker build

docker

#1

Our tech stacks include using CircleCI, Docker, and a Ruby application. CircleCI tests the Ruby application and if it succeeds, then it proceeds to build a Docker image using the Dockerfile within the app repo and pushes out to Dockerhub.

We have a Github user key configured under Project Settings-> Checkout SSH keys that have permissions to our private repos. Our Gemfile includes a Git gem where it checks out a private repo using the user key.

gem "some_project", git: "git@github.com:organization/some_project.git", branch: "develop"

Bundle Install during tests works fine because of the user key in CircleCI. During Docker build however, It fails because the Docker container doesn’t have Github credentials.

The error:
Fetching git@github.com:organization/some_project.git
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

Is there any way for the Docker build running in a CircleCI VM to inherit the Github user key in Project Settings?

Thank you,
Justin


#2

Circle Folks

It would be great if you could provide support for passing secrets to Docker images. The inability to do that hinders use of Docker with any private data, such as private git repos.

Thanks
Arthur


#3