I created a Dockerfile that looks as follows:
FROM node
ARG SSH_KEY
RUN apt-get -y update
RUN apt-get -y install git
RUN apt-get -y install openssh-server
RUN mkdir -p /root/.ssh && \
chmod 0700 /root/.ssh && \
ssh-keyscan github.com > /root/.ssh/known_hosts
# Add the keys and set permissions
RUN echo "$ssh_prv_key" > /root/.ssh/id_rsa && \
echo "$ssh_pub_key" > /root/.ssh/id_rsa.pub && \
chmod 600 /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa.pub
ADD id_rsa /root/.ssh/
ADD id_rsa.pub /root/.ssh
RUN chmod 600 /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa.pub
WORKDIR /app
RUN git config --global http.sslverify false
RUN git clone git@github.com:myorg/myrepo.git /app
I create image with:
docker build -t python-cleanup .
and then I run the docker with:
docker run -ti -v C:\github\decrypt-cleanup-docker:/app python-cleanup
the problem is that after running the docker I cannot see the file from the github repo.
but, if I run the docker with the following command:
docker run -it -v C:\github\decrypt-cleanup-docker:/app python-cleanup git clone git@github.com:myorg/myproject.git
then the files appears in the /app folder
what I am doing wrong or not understanding properly?