background The test environment uses Jenkins integrated with the docker plug-in to implement a one-click deployment service for the test environment. First, Jenkins has installed the docker build and publish plug-in, but a series of problems have occurred in the operation of the job! Question 1Docker execution reports an error, Build step 'Docker Build and Publish' marked build as failure. There are many problems that lead to this sentence. More detailed error information: Jenkins container does not support docker operations? Analysis of the problem: Jenkins is deployed using docker, so there are no docker-related operation commands in the Jenkins container, so the execution fails! Solution: You need to map the host's Docker environment to the Jenkins container before you can use the Docker command line. docker run --name myjenkins -p 8123:8080 -p 50000:50000 -v /run/docker.sock:/var/run/docker.sock -v /var/jenkins_home:/var/jenkins_home -u 0 -d jenkins/jenkins:lts Execute again, the result is still wrong, no solution! Error 2It prompts that there is no executable command in the bin directory? Analysis: We know that for any environment that we install, if we want to execute its command line in the Linux environment, we need to add the environment variable: /usr/bin Solution: Continue to map the host docker executable command docker run --name myjenkins -p 8123:8080 -p 50000:50000 -v /run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v /var/jenkins_home:/var/jenkins_home -u 0 -d jenkins/jenkins:lts Tips: The which command is similar to whereis to find commands or files: the former checks the commands in the system environment variables (returns the first result), and the latter returns the path related to the program name (returns all matching results) Error 3Unable to find related dependencies: error while loading shared libraries: libltdl.so.7: cannot open shared object file: No such file or/libltdl.so.7 Analysis: Inside the jenkins container, because the container is not shared with the host, the library can be found on the host: cd usr/lib64/ Solution: Find the libltdl.so.7 dependency library on the host and mount the container docker run --name myjenkins -p 8123:8080 -p 50000:50000 -v /run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v /usr/lib64/libltdl.so.7:/usr/lib/x86_64-linux-gnu/libltdl.so.7 -v /var/jenkins_home:/var/jenkins_home -v /var/data/shell:/var/data/shell -u 0 -d jenkins/jenkins:lts Error 4no basic auth credentials No authentication Analysis of the cause: This plug-in uses the docker command inside the jenkins container. There is no error in building the image. When it needs to be pushed to the image repository in the container, auth is required. Solution: Directly add a line of authentication to the Jenkins job, docker login --username=xxxx --password=xxxx nexus.xxxx.com Tips: After executing the command, a .credentials will be generated in the current directory, which records the account and password information for logging in to the nexus image repository Summarize At this point, the previous steps have been completed and docker commands can be used inside the jenkins container. There is no need to use the shh plug-in to jump out of the container to the host to execute the build & push operation commands. You only need to execute the script to start the container! In Docker containerization, everything mapped between the host and the container is the same, that is, whether the file mounted on the host in the container is modified or the mounted host file is modified in the container, both will be modified at the same time. This is the end of this article about some methods to solve the problem of Jenkins integrated docker plug-in. For more relevant Jenkins integrated docker plug-in content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
>>: JavaScript implements the detailed process of stack structure
How to use the MySQL authorization command grant:...
Discuz! Forum has many configuration options in th...
Table of contents 1. Trigger Solution 2. Partitio...
Table of contents 1. List traversal 2. The role o...
Table of contents 1. Basic knowledge: 2. DHCP ser...
Nginx is configured with the same domain name, wh...
Preface Recently I started using robot framework ...
This article shares the specific code for impleme...
What is a mata tag The <meta> element provi...
Preface Recently, I was analyzing the startup pro...
1. I searched for a long time on the Internet but...
This article shares the installation tutorial of ...
Table of contents Parent component listBox List c...
This article shares the specific code for the WeC...
View the dependent libraries of so or executable ...