“COPY plugins.txt” in Jenkins in Docker in Windows failed

坚强是说给别人听的谎言 提交于 2020-07-10 10:26:00

问题


docker pull jenkinsci/blueocean

docker network create jenkins

docker volume create jenkins-docker-certs
docker volume create jenkins-data

docker container run --name jenkins-docker --rm --detach --privileged --network jenkins --network-alias docker --env DOCKER_TLS_CERTDIR=/certs --volume jenkins-docker-certs:/certs/client --volume jenkins-data:/var/jenkins_home docker:dind

docker container run --name jenkins-blueocean --rm --detach --network jenkins --env DOCKER_HOST=tcp://docker:2376 --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 --volume jenkins-data:/var/jenkins_home --volume jenkins-docker-certs:/certs/client:ro --publish 1122:8080 --publish 50000:50000 jenkinsci/blueocean

then,

//method 1, failed
FROM jenkinsci/blueocean:latest
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt
////////////////////////////////////////////////////////////////////
Step 2/3 : COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
COPY failed: stat /var/lib/docker/tmp/docker-builder945145338/plugins.txt: no such file or directory
////////////////////////////////////////////////////////////////////

//method 2, failed
FROM jenkinsci/blueocean:latest
COPY plugins /var/jenkins_home/plugins/

//method 3, warning and plugins still not include
FROM jenkinsci/blueocean:latest
COPY . /var/jenkins_home/plugins/
////////////////////////////////////////////////////////////////////
A@pc2 MINGW64 /f/jenkins_blueocean $ docker build -t my_custom_jenkins . Sending build context to Docker daemon 2.048kB Step 1/2 : FROM jenkinsci/blueocean:latest ---> 69b6d837d67b Step 2/2 : COPY . /var/jenkins_home/ ---> b1bf0ef60bff Successfully built b1bf0ef60bff Successfully tagged my_custom_jenkins:latest SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
////////////////////////////////////////////////////////////////////

I tried the above COPY cmd in (DockerToolbox-19.03.1.exe)Docker Quickstart Terminal & Windows PowerShell(Admin), both failed... the error info are sth like this:

Step 2/3 : COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
COPY failed: stat /var/lib/docker/tmp/docker-builder945145338/plugins.txt: no such file or directory

I want to install Jenkins and the needed plugins in Docker in Windows, and then save the Jenkins&all the plugins use Docker, in order to use the Jenkins&all the plugins in another Offline PC.

来源:https://stackoverflow.com/questions/62778288/copy-plugins-txt-in-jenkins-in-docker-in-windows-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!