I followed the websit Docker
a.Create a Dockerfile with the following content:
FROM jenkins/jenkins:2.414.2-jdk17
USER root
RUN apt-get update && apt-get install -y lsb-release
RUN curl -fsSLo /usr/share/keyrings/docker-archive-keyring.asc \
https://download.docker.com/linux/debian/gpg
RUN echo "deb [arch=$(dpkg --print-architecture) \
signed-by=/usr/share/keyrings/docker-archive-keyring.asc] \
https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
RUN apt-get update && apt-get install -y docker-ce-cli
USER jenkins
RUN jenkins-plugin-cli --plugins "blueocean docker-workflow"
b.Build a new docker image from this Dockerfile, and assign the image a meaningful name, such as “myjenkins-blueocean:2.414.2-1”:
docker build -t myjenkins-blueocean:2.414.2-1 .
I can get this logs infor:
Sending build context to Docker daemon 2.56kB
Step 1/8 : FROM jenkins/jenkins:2.414.2-jdk17
---> 5485017782fb
Step 2/8 : USER root
---> Using cache
---> 1861abe034ba
Step 3/8 : RUN apt-get update && apt-get install -y lsb-release
---> Running in b1760add3f0c
Get:1 https://packagecloud.io/github/git-lfs/debian bookworm InRelease [25.8 kB]
Get:2 https://packagecloud.io/github/git-lfs/debian bookworm/main amd64 Packages [2131 B]
Get:3 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:4 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
Get:5 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:6 http://deb.debian.org/debian bookworm/main amd64 Packages [8906 kB]
Get:7 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [6432 B]
Get:8 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [63.2 kB]
Fetched 9255 kB in 1min 32s (101 kB/s)
Reading package lists...
E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
E: Sub-process returned an error code
The command '/bin/sh -c apt-get update && apt-get install -y lsb-release' returned a non-zero code: 100
It throws error like this:
E: Problem executing scripts APT::Update::Post-Invoke ‘rm -f /var/cache/apt/archives/.deb /var/cache/apt/archives/partial/.deb /var/cache/apt/*.bin || true’
E: Sub-process returned an error code
The command ‘/bin/sh -c apt-get update && apt-get install -y lsb-release’ returned a non-zero code: 100
So, Please help me to fix it.