0

I want to use a dind docker image as a base image and then install jenkins inside it. this is my dockerfile : ...

FROM docker:20.10.11-dind-alpine3.14
USER root
RUN apk add curl &&\
    curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key |  tee &&\
    /usr/share/keyrings/jenkins-keyring.asc > /dev/null &&\
    echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] &&\
    https://pkg.jenkins.io/debian-stable binary/ |  tee &&\
    /etc/apt/sources.list.d/jenkins.list > /dev/null &&\
    apt-get update &&\
    apt-get install jenkins &&\
    apk update &&  apk upgrade && \
    apk add --update nodejs npm

...

i took the installation commands from jenkins installation guide for ubunto but when i start to build the image i get this error :

...

/bin/sh: /usr/share/keyrings/jenkins-keyring.asc: not found

...

David Maze
  • 130,717
  • 29
  • 175
  • 215
  • You did not quite [copy the commands](https://www.jenkins.io/doc/book/installing/linux/#long-term-support-release) correctly – Ian W Nov 27 '21 at 11:58
  • Can you run "Docker" and "Jenkins" as two separate things, maybe running Jenkins within your host Docker daemon rather than trying to use DinD? Then you'd be able to use the unmodified `jenkins/jenkins` image. – David Maze Nov 27 '21 at 12:45

1 Answers1

0

In my case, I have used the jenkins official docker image and mount docker.sock to use the host docker.

docker container run --name jenkins --detach --restart=always \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume jenkins-data:/var/jenkins_home \
  --publish 8081:8080 \
  --publish 50000:50000 \
  jenkins/jenkins:latest-jdk8
Lamanus
  • 12,898
  • 4
  • 21
  • 47