-
-
Save guilouro/c86355a95581b8fe478c1d5b26d7922e to your computer and use it in GitHub Desktop.
FROM ubuntu | |
MAINTAINER Guilherme Louro "[email protected]" | |
# Update aptitude with new repo | |
RUN apt-get update | |
# Install software | |
RUN apt-get install -y git | |
# Make ssh dir | |
RUN mkdir /root/.ssh/ | |
# Copy over private key, and set permissions | |
ADD id_rsa /root/.ssh/id_rsa | |
# Create known_hosts | |
RUN touch /root/.ssh/known_hosts | |
# Add bitbuckets key | |
RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts | |
# Clone the conf files into the docker container | |
RUN git clone [email protected]:User/repo.git |
@guilouro I got this problem:
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
I already added the private key.
Any solution here? please advise
any advise about the Permission denied error?
There are some security risks in copying your private key into the container. Here is an overview and an alternative
you can also use --mount=type=ssh
for details https://docs.docker.com/develop/develop-images/build_enhancements/#overriding-default-frontends
Hey @OmriTreidel,
Thanks for your comment. I don't use this config anymore. But your comment is very important for those who find this gist and try to use it.
I have a question : the public key should be put in the bitbucket account by F/E or lines
#Add bitbuckets key
RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts
Do all the magic ? Thanks for the answer.
@guilouro = 🥇