简体   繁体   中英

error while building jenkins docker image

I'm trying to build jenkins docker image locally using the jenkins Dockerfile locally and I keep getting this error.

Step 17/34 : COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy
COPY failed: stat /var/lib/docker/tmp/docker-builder028619870/init.groovy: no such file or directory

Here's the Dockerfile that I am using. And this is the build command I am using(Dockerfile is in the PWD) :

docker build -t jenkins-k8s .

As you can see in these Github Repo there is a file named init.groovy . And in the Dockerfile there is a Statement like

COPY init.groovy /SOME/PATH/IN/THE/CONTAINER

When you want to use this Dockerfile, you have to download the init.groovy as well. But there are more COPY Statements in these Dockerfile.

Dont know if you need such a big Dockerfile for your needs.

For our needs we just use the official ParentImage from DockerHub.

FROM jenkins/jenkins:2.73.3

USER root
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > 
/etc/timezone

USER jenkins

You can change the Version and the Timezone for your needs.

I recommend cloning the git repository before building the Dockerfile:

git clone https://github.com/jenkinsci/docker

cd docker 

git checkout 587b2856cd225bb152c4abeeaaa24934c75aa460  # Switch to the version you mentioned in the question.

docker build -t jenkins-k8s .

By doing so, you are guaranteed to have all the files that are required to build the Dockerfile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM