Newbie question. around modifying https://hub.docker.com/r/jenkins/ssh-agent

Hi, We want to use the jenkins ssh-agent docker container as a basis and to then expand / modify, for some work we want to do.

https://hub.docker.com/r/jenkins/ssh-agent

We want to add support for oracleLinux9

So from the target agent machine i pull and modify the github repository and build it locally and run the image locally on the agent host.

When i try to run a job from my jenkins controller targeting the docker agent i get the following error.

com.github.dockerjava.api.exception.NotFoundException: Status 404: {“message”:“manifest for blahBlahBlah
container//image not found: manifest unknown: manifest unknown”}

When i make a modification do i have to register a container on docker hub ?

Thanks in advance

hello @zanderfortinbras ,
could you please share minimal dockerfile you are trying? and compete error stack.
also have you tired by passing

--platform linux/amd64,linux/arm64

during build and push/pull

also you may need to push to repo, depending upon how you are using the image.

@alishah730

The new repository is here with the changes

@alishah730

Error in provisioning; template='DockerTemplate{configVersion=2, labelString='dockerImage', connector=DockerComputerSSHConnector{sshKeyStrategy=InjectSSHKey{user='blahblah'}, port=blahblah}, instanceCap=2147483647, mode=NORMAL, retentionStrategy=com.nirima.jenkins.plugins.docker.strategy.DockerOnceRetentionStrategy@29, dockerTemplateBase=DockerTemplateBase{image='jenkins/ssh-agent:oracleLinux-jdk11', bindAllPorts=false, cpuPeriod=0, cpuQuota=0, privileged=false, tty=false}, removeVolumes=false, stopTimeout=10, pullStrategy=PULL_ALWAYS, pullTimeout=300, disabled=BySystem,0 ms,4 min 59 sec,Template provisioning failed., name='dockerImage'}' for cloud='docker'
com.github.dockerjava.api.exception.NotFoundException: Status 404: {"message":"manifest for jenkins/ssh-agent:oracleLinux-jdk11 not found: manifest unknown: manifest unknown"}

	at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:241)
	at com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
	at java.base/java.lang.Thread.run(Thread.java:829)
FROM eclipse-temurin:11.0.18_10-jdk-focal AS jre-build

RUN jlink \
         --add-modules ALL-MODULE-PATH \
         --no-man-pages \
         --compress=2 \
         --output /javaruntime

FROM oraclelinux:9-slim

ARG user=jenkins
ARG group=jenkins
ARG uid=1000
ARG gid=1000
ARG JENKINS_AGENT_HOME=/home/${user}

ENV JENKINS_AGENT_HOME=${JENKINS_AGENT_HOME}
ARG AGENT_WORKDIR="${JENKINS_AGENT_HOME}"/agent
# Persist agent workdir path through an environment variable for people extending the image
ENV AGENT_WORKDIR=${AGENT_WORKDIR}

RUN groupadd -g ${gid} ${group} \
    && useradd -d "${JENKINS_AGENT_HOME}" -u "${uid}" -g "${gid}" -m -s /bin/bash "${user}" \
    # Prepare subdirectories
    && mkdir -p "${JENKINS_AGENT_HOME}/.ssh/" "${AGENT_WORKDIR}" "${JENKINS_AGENT_HOME}/.jenkins" \
    # Make sure that user 'jenkins' own these directories and their content
    && chown -R "${uid}":"${gid}" "${JENKINS_AGENT_HOME}" "${AGENT_WORKDIR}"

RUN microdnf -y install \
            git-lfs \
            less \
            openssh-server \
            patch \
           && microdnf clean all

# setup SSH server
RUN sed -i /etc/ssh/sshd_config \
        -e 's/#PermitRootLogin.*/PermitRootLogin no/' \
        -e 's/#RSAAuthentication.*/RSAAuthentication yes/'  \
        -e 's/#PasswordAuthentication.*/PasswordAuthentication no/' \
        -e 's/#SyslogFacility.*/SyslogFacility AUTH/' \
        -e 's/#LogLevel.*/LogLevel INFO/' && \
    mkdir /var/run/sshd

# VOLUME directive must happen after setting up permissions and content
VOLUME "${AGENT_WORKDIR}" "${JENKINS_AGENT_HOME}"/.jenkins "/tmp" "/run" "/var/run"
WORKDIR "${JENKINS_AGENT_HOME}"

ENV LANG='C.UTF-8' LC_ALL='C.UTF-8'

ENV JAVA_HOME=/opt/java/openjdk
ENV PATH="${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /opt/java/openjdk $JAVA_HOME

RUN echo "PATH=${PATH}" >> /etc/environment

COPY setup-sshd /usr/local/bin/setup-sshd

EXPOSE 22

ENTRYPOINT ["setup-sshd"]

LABEL \
    org.opencontainers.image.vendor="Jenkins project" \
    org.opencontainers.image.title="Official Jenkins SSH Agent Docker image" \
    org.opencontainers.image.description="A Jenkins agent image which allows using SSH to establish the connection" \
    org.opencontainers.image.url="https://www.jenkins.io/" \
    org.opencontainers.image.source="https://github.com/jenkinsci/docker-ssh-agent" \
    org.opencontainers.image.licenses="MIT"

If you build the image on a different machine not where you run the container then yes. Or at least you need a registry even if it is not Docker Hub. You can also export a local image using docker save and import it on a remote machine using docker load. Check the help for more details: docker save --help

After reading the comments it was stil not clear to me if you run the container where the image was built, but I think @alishah730 was referring to the same possibility as I

Of course you won’T be able to push the image to Docker Hub with this name, sou you would need to change the “owner” part from “jenkins” to an your user. Or add a different private registry to the tag as well.

I am building on the host linux oracleLinux box which will run the oracleLinux9 container.
I am configuring the node on the jenkins controller box.
The test job is on the jenkins controller box also.

This is what is really confusing me I am orchestrating from the controller which calls out to the jenkinsHost hosting the docker container … which was built on that same box.