What I want to do
I'm trying to connect to github with ssh while building python docker image.
FROM python:3.10.4 AS builder
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
WORKDIR /running
COPY ./pyproject.toml ./
# copy key
COPY github.pem /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa
# Add the necessary SSH config
RUN echo 'Host * \n\
IdentityFile /root/.ssh/id_rsa \n\
' > /root/.ssh/config
RUN which ssh
RUN ssh -T git@github.com
instead below happened
the result is...
#12 [8/8] RUN ssh -T git@github.com
#12 sha256:009cd770ecaf452b09b48969487c7957d5c5fddf449cc2ea54bc195b09c44e37
#12 1.230 Host key verification failed.
#12 ERROR: executor failed running [/bin/sh -c ssh -T git@github.com]: exit code: 255
but I can connect to github well with that ssh key in my local mac
the question
how do I connect to github while building docker image?