################################################################################
# Ubuntu 22.10
FROM ubuntu:22.10
################################################################################
# Install packages
RUN apt-get update && apt-get install --yes --no-install-recommends \
build-essential \
gfortran \
meson \
pkg-config \
sox \
git \
cmake \
openssh-client \
python3 \
python3-pip \
python3-numpy
################################################################################
# Create a Jenkins user with proper host group id and user id
ARG UNAME=jenkins
# Get group and user ids from outside "docker build" command line
ARG GID=
ARG UID=
RUN groupadd --gid $GID $UNAME && \
useradd --gid $GID --uid $UID --home-dir /home/$UNAME --create-home $UNAME
################################################################################
# Add github.com to the list of known ssh hosts for user Jenkins
USER $UNAME
RUN mkdir /home/$UNAME/.ssh/ && \
touch /home/$UNAME/.ssh/known_hosts && \
ssh-keyscan github.com >> /home/$UNAME/.ssh/known_hosts
################################################################################
# Install myproj from myrepos:
RUN pip3 install --upgrade --user git+ssh://[email protected]/myrepos/myproj@master
################################################################################
I've created the above Dockerfile used by Jenkins automation server. The Dockerfile contains some fiddling with SSH keys to enable jenkins user to access my Git repositories. This enabled jenkins to run meson build system commands (and meson needs access to GitHub). All worked OK.
But now I needed to install a package from my GitHub repo which I usually install like this:
pip3 install --upgrade --user git+ssh://[email protected]/myrepos/myproj@master
However, when docker is run, I get error on the last RUN line:
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
How would I access the repo from Dockerfile?