Home > Back-end >  /bin/sh: 1: apk: not found (when using jenkins/agent:latest-jdk11)
/bin/sh: 1: apk: not found (when using jenkins/agent:latest-jdk11)

Time:02-28

I have this Dockerfile:

FROM  jenkins/agent:latest-jdk11
RUN apk --no-cache add curl

But when I try and build it I get:

Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM  jenkins/agent:latest-jdk11
 ---> 6f9ed88cf9cc
Step 2/2 : RUN apk --no-cache add curl
 ---> Running in 2f0f9c1279b6
/bin/sh: 1: apk: not found

As I understand apk is the package management for Alpine images. Looking at the base image:

docker inspect jenkins/agent:latest-jdk11

I see the following labels:

    "Labels": {
        "Description": "This is a base image, which provides the Jenkins agent executable (agent.jar)",
        "Vendor": "Jenkins project",
        "Version": "4.10",
        "org.opencontainers.image.description": "This is a base image, which provides the Jenkins agent executable (agent.jar)",
        "org.opencontainers.image.licenses": "MIT",
        "org.opencontainers.image.source": "https://github.com/jenkinsci/docker-agent",

At that location there is indeed an alpine version of the image:

https://github.com/jenkinsci/docker-agent/blob/master/11/alpine/Dockerfile

but apparently that is not what jenkins/agent:latest-jdk11 is based on. So how do I find out which distro jenkins/agent:latest-jdk11 is?

CodePudding user response:

But at that location there is also a Debian version and a Windows version. The one with the latest-jdk11 tag is a Debian version. You can see the OS version with this command

docker run --rm jenkins/agent:latest-jdk11 cat /etc/os-release

which shows that it's Debian Bullseye.

To get the alpine version, you can use the latest-alpine-jdk11 tag.

  • Related