英文:
How to set up docker in Jenkins?
问题
我正在尝试从Jenkins内部连接到Docker。我还下载了与Docker相关的插件。但不知何故,Docker连接未提供。可能的原因是什么?
首先,我正在使用Windows操作系统。
我已经安装了Docker。
我在Docker中运行了Jenkins。
我创建了我的GitHub存储库。
我在Jenkins中编写了脚本管道。
m2文件似乎已在我的计算机上创建。
我在Jenkins的工具中下载了Maven和Docker。
Docker:我提供了我计算机上docker.exe文件的扩展名,但它没有工作。
Docker:我尝试了docker和latest,但它没有工作。
我也不知道为什么第二张图片中会出现@temp文件。可能的原因是什么?
我还向我的项目添加了Docker文件。
英文:
I'm trying to connect to docker from within Jenkins. I also downloaded the plugins related to docker. But somehow the docker connection was not provided. What could be the reason for this?
First of all, I am working on windows operating system.
I have installed docker.
I ran Jenkins in docker.
I created my github repo.
I wrote script pipeline in jenkins.
m2 files appear to have been created on my computer.
I downloaded maven and docker inside tools in Jenkins.
Docker : I gave the extension of the docker.exe file on my computer but it didn't work.
Docker : I did docker and latest but it didn't work.
my jenkins_home file and workspace my project
I also don't know why the @temp file occurs in the 2nd picture. What could be the reason for this?
I also added docker file to my projects.
答案1
得分: 1
运行以下命令:
docker run -p 8080:8080 -p 50000:50000 -d -v /var/run/docker.sock:/var/run/docker.sock -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts
运行以下命令:
docker exec -it --user root <container id> bash
运行以下命令:
curl https://get.docker.com/ > dockerinstall && chmod 777 dockerinstall && ./dockerinstall
运行以下命令:
sudo chmod 666 /var/run/docker.sock
运行以下命令:
docker exec -it <container id> bash
cat var/jenkins_home/secrets/initialAdminPassword
英文:
Solved Question : Let's run the commands in order;
1.
docker run -p 8080:8080 -p 50000:50000 -d -v /var/run/docker.sock:/var/run/docker.sock -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts
2.
docker exec -it --user root <container id> bash
3.
curl https://get.docker.com/ > dockerinstall && chmod 777 dockerinstall && ./dockerinstall
4.
sudo chmod 666 /var/run/docker.sock
5.
docker exec -it <container id> bash
cat var/jenkins_home/secrets/initialAdminPassword
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论