I am new here, first post ever.
Jenkins setup:
jenkins: 2.555.1
java: openjdk 21.0.11 2026-04-21
OpenJDK Runtime Environment (build 21.0.11+10-1-deb13u2-Debian)
OpenJDK 64-Bit Server VM (build 21.0.11+10-1-deb13u2-Debian, mixed mode, sharing)
Installation methods:
- APT repository (main linux system)
- Docker image (jenkins in docker - please see below)
Browser: Firefox 150.0.1 (64-bit)
scm: not used here
System: MXLinux 25.1:
Kernel: 6.12.85+deb13-amd64 arch: x86_64 bits: 64 compiler: gcc v: 14.2.0 clocksource: tsc
avail: hpet,acpi_pm parameters: BOOT_IMAGE=/boot/vmlinuz-6.12.85+deb13-amd64 root=UUID=
ro quiet splash
Desktop: Xfce v: 4.20.1 tk: Gtk v: 3.24.48 wm: xfwm4 v: 4.20.0 with: docker,xfce4-panel
tools: xfce4-screensaver vt: 7 dm: LightDM v: 1.32.0 Distro: MX-25.1_Xfce_x64 Infinity January
18 2026 base: Debian GNU/Linux 13 (trixie)
Machine:
Type: Desktop System: ASUS product: N/A v: N/A serial:
Mobo: ASUSTeK model: ROG STRIX B550-F GAMING v: Rev X.0x serial:
part-nu: SKU uuid: UEFI: American Megatrends v: 3611 date: 09/29/2024
CPU:
Info: model: AMD Ryzen 7 5800XT bits: 64 type: MT MCP arch: Zen 3+ gen: 3 level: v3 note: check
built: 2022 process: TSMC n6 (7nm) family: 0x19 (25) model-id: 0x21 (33) stepping: 2
microcode: 0xA201210
Topology: cpus: 1x dies: 1 clusters: 1 cores: 8 threads: 16 tpc: 2 smt: enabled cache:
L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB L3: 32 MiB desc: 1x32 MiB
Plugins:
The issue is getting the command ādocker buildx buildā, as opposed to ādocker buildā, to work in my jenkins pipeline/docker setup.
The reason is "docker buildā is to be deprecated and removed, and I am addressing the issue of impending technical debt.
Compare these two lines in āBuild Docker imageā stage (please see code below):
- ādocker build -t ${IMAGE_NAME} .ā works in jenkins and on my main system (a debian-derived linux distro called āMXLinuxā)
- ādocker buildx build -t ${IMAGE_NAME} --load .ā does not work in jenkins, however does work on my main system with the Dockerfiles below
ā¦and ābuildxā is not recognized on jenkins, even though ābuildxā is installed on my main system and should be accessible via docker.sock in a DooD setup. Puzzling, as ādocker buildā is an alias for ādocker buildx buildā.
The context is a custom dockerized jenkins container built for Docker-outside-of-Docker (DooD) architecture, where the jenkins Docker image installs docker-ce-cli , not full Docker, as well as maven.
Here is the Dockerfile code for that purpose:
##############################################
### Custom Jenkins controller with Maven + Docker CLI (DooD)
FROM jenkins/jenkins:lts
USER root
### Basic tools + Maven
RUN apt-get update && \
apt-get install -y --no-install-recommends \
maven \
ca-certificates \
curl \
gnupg && \
rm -rf /var/lib/apt/lists/*
### Install Docker CLI only (no daemon) from Docker's official repo
RUN install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo \"$VERSION_CODENAME\") stable" > /etc/apt/sources.list.d/docker.list && \
apt-get update && \
apt-get install -y --no-install-recommends docker-ce-cli && \
rm -rf /var/lib/apt/lists/*
### Drop back to the Jenkins user
USER jenkins
##############################################
This Docker image is instantiated as a jenkins controller Docker container with this command:
##############################################
docker run -d \
--name mvn-jenkins \
--group-add "$(getent group docker | cut -d: -f3)" \
--restart unless-stopped \
-p 8082:8080 \
-p 50002:50000 \
-v jenkins_home:/var/jenkins_home \
-v /home/ra/.ssh:/var/jenkins_home/.ssh \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkins-with-maven-docker
##############################################
My Jenkins controller plugins include:
Docker API, Docker commons, Docker and Docker pipeline.
My Jenkinsfile declarative pipeline uses a Docker agent, instantiated with this Dockerfile:
##############################################
FROM maven:3.9.15-amazoncorretto-21-debian
USER root
### Install Docker CLI only
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg && \
rm -rf /var/lib/apt/lists/* && \
install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo \"$VERSION_CODENAME\") stable" > /etc/apt/sources.list.d/docker.list && \
apt-get update && \
apt-get install -y --no-install-recommends docker-ce-cli && \
rm -rf /var/lib/apt/lists/*
### Use a non-root UID (Jenkins agents typically run as 1000)
RUN useradd -u 1000 -m jenkins
RUN groupadd docker || true
RUN usermod -aG docker jenkins
USER jenkins
WORKDIR /home/jenkins
##############################################
Here is the problematic Jenkinsfile, I draw your attention to the agent and stage(āBuild Docker imageā):
##############################################
pipeline {
// must first manually extend permissions
// for /run/docker.sock on main system to 'other':
// sudo chmod a+rw /run/docker.sock
agent {
docker {
image 'maven-docker-agent'
args '-v /var/run/docker.sock:/var/run/docker.sock'
}
}
environment {
IMAGE_NAME = 'java-hello:local'
CONTAINER_NAME = 'java-hello'
}
stages {
stage('Remove old Maven project') {
steps {
deleteDir()
}
}
stage('Generate new Maven project') {
steps {
sh '''
mvn archetype:generate \
-DgroupId=com.mycompany.app \
-DartifactId=my-app \
-DarchetypeArtifactId=maven-archetype-quickstart \
-DarchetypeVersion=1.5 \
-DinteractiveMode=false
echo "completed mvn archetype:generate"
'''
}
}
stage('Build JAR') {
steps {
dir('my-app') {
sh '''
mvn -B -DskipTests clean package
echo "built JAR"
'''
}
}
}
// when using EOF in groovy, put all lines up against left margin
// to eliminate whitespace (see below)
stage('Prepare Docker context') {
steps {
dir('my-app') {
sh '''
cat > Dockerfile <<'EOF'
FROM eclipse-temurin:25-jre-ubi10-minimal
WORKDIR /app
COPY target/my-app-1.0-SNAPSHOT.jar /app/app.jar
ENTRYPOINT ["java","-cp","/app/app.jar","com.mycompany.app.App"]
EOF
echo "built Dockerfile"
cat > .dockerignore <<'EOF'
target/*
!target/my-app-1.0-SNAPSHOT.jar
.git
.gitignore
EOF
echo "built .dockerignore"
'''
}
}
}
stage('Build Docker image') {
steps {
dir('my-app') {
sh '''
docker build -t ${IMAGE_NAME} .
# docker buildx build -t ${IMAGE_NAME} --load .
echo "built Docker image ${IMAGE_NAME}"
'''
}
}
}
stage('Run container') {
steps {
sh '''
echo "--- Container output below ---"
docker run --rm --name ${CONTAINER_NAME} ${IMAGE_NAME}
'''
}
}
}
}
I tried different variations of the buildx command, to no avail, and experimented with the āDocker pluginā, however I am unsure if it is right for this situation or if I followed the Docker plugin instructions correctly.
Has anyone gotten ādocker buildxā to work in a DooD scenario?