I'm trying to install a pip package from a private, secure repo with pip inside a Dockerfile
I have created a id_rsa key and added as a deploy key to that repo.
I'm trying to COPY these keys inside the container and running pip afterward.
Dockerfile relevant parts:
# Saving custom SSH key for git
RUN mkdir -p /root/.ssh && chmod 0700 /root/.ssh && ssh-keyscan -v -p 10223 -T 240 gitea.****.**** > /root/.ssh/known_hosts
# Copy private key
COPY ./keys/id_rsa /root/.ssh/id_rsa
# Copy public key
COPY ./keys/id_rsa.pub /root/.ssh/id_rsa.pub
# Changing permissions
RUN chmod 0600 /root/.ssh/id_rsa && chmod 0600 /root/.ssh/id_rsa.pub
RUN pip install --upgrade pip
COPY ./requirements ./requirements
RUN pip install -r ./requirements/requirements.txt
The output when I try to run docker build:
Cloning ssh://****@gitea.****.****:10223/****/****.git (to revision master) to ./src/package
Running command git clone --filter=blob:none --quiet 'ssh://****@gitea.*****.****:10223/******/*******.git' /usr/src/app/src/package
Warning: Permanently added the ECDSA host key for IP address '[XXX.XXX.XXX.XXX]:10223' to the list of known hosts.
Load key "/root/.ssh/id_rsa": invalid format
git@gitea.marinero.hu: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
error: subprocess-exited-with-error