Skip to content

Instantly share code, notes, and snippets.

@guilouro
Last active November 9, 2021 16:22
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save guilouro/c86355a95581b8fe478c1d5b26d7922e to your computer and use it in GitHub Desktop.
Save guilouro/c86355a95581b8fe478c1d5b26d7922e to your computer and use it in GitHub Desktop.
Clone bitbucket private repo in Dockerfile
FROM ubuntu
MAINTAINER Guilherme Louro "guipclouro@gmail.com"
# 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 git@bitbucket.org:User/repo.git
@vanbrace
Copy link

vanbrace commented Nov 9, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment