I
I
Igor Kravchenko2015-09-21 09:58:49
Bitbucket
Igor Kravchenko, 2015-09-21 09:58:49

How to get code from bitbucket to new docker container?

I want the source of my code to automatically arrive there when the container is opened on a remote machine, and when the repository is updated, everything is updated and rebuilt.
To do this, I use https://www.tutum.co/ , synchronization with the repository and webhook I set up, the only problem is that I can not set up automatic fetching code from a private repository on bitbucket.
With github it is clear how to get the code (from the public), but how to get the code from bitbucket (private)?
Ssh key? - but how to put it on the zero machine?
By password? - swears for access if you write:
hg clone https://Login:[email protected]/Login/repa

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Kravchenko, 2015-11-19
@Gorniv

In general, the problem was in an incomplete understanding of how Docker works, more precisely
the ADD and COPY commands - they have the ability to access the data that you put in the hub.docker.com repository, or in my case, all the code from the bitbucket repository.
But, if you need, for example, to get the code from the repository (part of the docker file):

RUN apt-get update && apt-get install -y git

RUN mkdir -p /root/.ssh
ADD youkey /root/.ssh/id_rsa
RUN chmod 700 /root/.ssh/id_rsa
RUN echo  "Host youkey"$'\n'"HostName bitbucket.org"$'\n'"IdentityFile /root/.ssh/id_rsa" >> /root/.ssh/config

# Create known_hosts
RUN touch /root/.ssh/known_hosts
# Add bitbuckets key
RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts

RUN git clone [email protected]:Login/repo.git

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question