<p>I want my default JNLP container to run with my image.
Therefore, I need to overrite the JNLP with my image, but to keep the JNLP data to be able to connect to my master.</p>
<ol>
<li>The jnlp image I should have as base is inbound-agent no?</li>
<li>How can I combine it with my image if I already have &quot;FROM UBUNTU&quot; can I combine multiple base images and copy the artifacts? How can I do that and what should be my dockerfile?</li>
</ol>
<p>My own image -</p>
<pre><code>FROM ubuntu:18.04

ARG JFROG_CI_INT_USERNAME
ARG JFROG_CI_INT_PASSWORD
ARG JFROG_CI_INT_NPM_TOKEN
ARG GITHUB_ORANGE_USER
ARG GITHUB_ORANGE_PASSWORD
ARG PULUMI_USER
ARG PULUMI_TOKEN

ENV GITHUB_ORANGE_USER=$GITHUB_ORANGE_USER
ENV GITHUB_ORANGE_PASSWORD=$GITHUB_ORANGE_PASSWORD
ENV DEBIAN_FRONTEND=noninteractive

#=============
# Set WORKDIR
#=============
WORKDIR /home/jenkins

COPY requirements.txt /
COPY authorization.sh /

# Update software repository
RUN apt-get update
RUN apt-get -qqy install software-properties-common
RUN add-apt-repository ppa:git-core/ppa
RUN add-apt-repository ppa:openjdk-r/ppa
RUN add-apt-repository ppa:deadsnakes/ppa

RUN apt-get -qqy install git

ENV PYTHON_VER=&quot;3.9&quot;

RUN apt-get -qqy update &amp;&amp; \
    apt-get -qqy --no-install-recommends install \
    gpg-agent \
    software-properties-common \
    openjdk-11-jdk \
    ca-certificates \
    build-essential \
    tzdata \
    zip \
    unzip \

ENTRYPOINT [&quot;/usr/local/bin/start.sh&quot;]
</code></pre>

EilonA
<p>You can do a <a href="https://docs.docker.com/build/building/multi-stage/" rel="nofollow noreferrer">multi-stage build</a> but you'll end with a tightly coupled image, and you'll have to rebuild it every time you want to change the jenkins agent version.</p>
<p>There's a better (IMHO) option, using two containers. You can run an agent in kubernetes using two images: inbound-agent and your image. This is from a working pipeline that I have:</p>
<pre class="lang-js prettyprint-override"><code>pipeline {
    agent {
        kubernetes {
            yaml &quot;&quot;&quot;
apiVersion: v1
kind: Pod
spec:
    containers:
    - name: jnlp
      image: jenkins/inbound-agent:4.10-3-alpine-jdk8
      volumeMounts:
      - name: home-volume
        mountPath: /home/jenkins
      env:
      - name: HOME
        value: /home/jenkins
    - name: maven
      image: my-registry:5000/maven-3.6.3-jdk-11:latest
      command:
      - sleep
      args: 
      - 1d
      volumeMounts:
      - name: home-volume
        mountPath: /home/jenkins
      env:
      - name: JAVA_TOOL_OPTIONS
        value: -Dfile.encoding=UTF8
    volumes:
    - name: home-volume
      emptyDir: {}
&quot;&quot;&quot;
        }
    }
    stages {
      stage('Build') {
        steps {
          script {
            container('maven') {
              sh('mvn clean deploy')
</code></pre>
<p>This way you have both images decoupled, but they run together in the same pod to make the pipeline work.</p>
