FROM fedora:latest
RUN yum install -y nginx git uwsgi
RUN echo "nameserver 8.8.4.4" > /etc/resolv.conf
RUN rm -rf /root/.ssh/ && mkdir -p /root/.ssh/
COPY id_rsa.pub /root/.ssh/id_rsa.pub
COPY id_rsa /root/.ssh/id_rsa
RUN cat /root/.ssh/id_rsa* && chmod 0400 /root/.ssh/id_rsa && echo "" > /root/.ssh/known_hosts
RUN mkdir -p /srv/nginx/
RUN ssh -vvv -p 49022 git@example.com || true
RUN git config --global user.email "somethingelse@example.com" && git config --global user.name "FunnyBunny"
RUN git clone --depth=1 ssh://git@example.com:port/repo.git /srv/nginx/repo
RUN chown -Rf nginx:nginx /srv/nginx
RUN rm -rf /root/.ssh/
USER nginx
EXPOSE 8080
CMD ["/usr/sbin/nginx"]
I added the public ssh id_rsa.pub
to my gitolite repo on the same host in another docker container. The bad thing is that cloning always fails.
Cloning into '/srv/nginx/repo'...
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
while the ping works just fine.
The ssh -vvv
line ends with
Host key verification failed.
On the other hand-side, importing public and private keys into a fedora:latest
and running just a git clone --depth ...
, just works!.
I am really puzzled how to fix this issue.
CoreOS version 557.2.0
This does not yield a viable solution: Using SSH keys inside docker container