{"id":268,"date":"2018-09-30T10:54:17","date_gmt":"2018-09-30T02:54:17","guid":{"rendered":"http:\/\/www.yinyubo.cn\/?p=268"},"modified":"2022-05-17T09:50:05","modified_gmt":"2022-05-17T01:50:05","slug":"dockerjenkins","status":"publish","type":"post","link":"https:\/\/www.yinyubo.com\/?p=268","title":{"rendered":"\u4f7f\u7528docker\u6784\u5efajenkins"},"content":{"rendered":"<h2><strong>1.\u62c9\u53d6docker hub\u4e0a\u7684jenkins\u955c\u50cf\uff0c\u5e76\u4e14\u8fd0\u884c<\/strong><\/h2>\n<p>\u53c2\u8003<a href=\"https:\/\/jenkins.io\/doc\/book\/installing\/\">https:\/\/jenkins.io\/doc\/book\/installing\/<\/a> \u6587\u7ae0\uff0c\u4f7f\u7528\u7684\u955c\u50cf\u662f<span style=\"color: #3366ff;\">jenkinsci\/blueocean<\/span><br \/>\n\u8f93\u5165\u547d\u4ee4<\/p>\n<pre class=\"lang:python decode:true \"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">docker pull jenkinsci\/blueocean<\/code><\/pre>\n<p>\u7136\u540e\u8f93\u5165\u8fd0\u884cdocker\u955c\u50cf\u547d\u4ee4\uff0c\u8fd9\u91cc\u6211\u9009\u62e98081\u7aef\u53e3\uff0c\u548cjenkins\u6570\u636e\u8def\u5f84<code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">\/root\/docker\/jenkins_home<\/code><\/p>\n<pre class=\"lang:python decode:true  EnlighterJSRAW\" data-enlighter-language=\"golang\"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">docker run \\\n  -u root \\\n  --rm \\\n  -d \\\n  -p 8081:8080 \\\n  -p 50000:50000 \\\n  -v jenkins-data:\/root\/docker\/jenkins_home \\\n  -v $PWD\/allure-results:\/allure-results \\\n  -v \/var\/run\/docker.sock:\/var\/run\/docker.sock \\\n  jenkinsci\/blueocean<\/code><\/pre>\n<h2><strong>2.\u6253\u5f00\u7f51\u9875\u76848081\u7aef\u53e3\uff0c\u767b\u5f55jenkins\u9996\u9875<\/strong><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-269 size-full\" src=\"https:\/\/yinyubo-1257235934.cos.ap-nanjing.myqcloud.com\/content\/Image-9.png\" alt=\"\" width=\"991\" height=\"894\" \/><br \/>\n\u53d1\u73b0\u9700\u8981\u8f93\u5165jenkins\u5bc6\u7801\u3002\u56e0\u4e3ajenkins\u662f\u5b89\u88c5\u5728docker\u91cc\u7684\uff0c\u6240\u4ee5\u8981\u8fdb\u5165docker\u5bb9\u5668\u91cc\u53bb\u5bfb\u627e\u5bc6\u7801<\/p>\n<h2><strong>3.\u8fdb\u5165\u5bb9\u5668\u91cc\uff0c\u83b7\u53d6\u7ba1\u7406\u5458\u5bc6\u7801<\/strong><\/h2>\n<p>\u8f93\u5165docker ps \u83b7\u53d6\u5bb9\u5668\u7684ID\uff0c290cbfd4bfe4<\/p>\n<pre class=\"lang:python decode:true\"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">[root@VM_0_12_centos docker]# docker ps -a\nCONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                           PORTS                                              NAMES\n290cbfd4bfe4        jenkinsci\/blueocean   \"\/sbin\/tini -- \/usr\/\u2026\"   10 minutes ago      Up 10 minutes                    0.0.0.0:50000-&gt;50000\/tcp, 0.0.0.0:8081-&gt;8080\/tcp   sharp_fermat\nde4a5ed40efd        friendlyhello         \"python app.py\"          47 hours ago        Exited (137) About an hour ago                                                      wizardly_kar<\/code><\/pre>\n<p>\u8fdb\u5165jenkins\u5bb9\u5668<\/p>\n<pre class=\"lang:python decode:true \"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">docker exec -it 910d23b3bd10 \/bin\/bash<\/code><\/pre>\n<p>\u8fdb\u5165\/var\/jenkins_home\/secrets\/\u76ee\u5f55<\/p>\n<pre class=\"lang:python decode:true\"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">cd \/var\/jenkins_home\/secrets<\/code><\/pre>\n<p>\u67e5\u770binitialAdminPassword<\/p>\n<pre class=\"lang:python decode:true\"><code class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">bash-4.4# cat initialAdminPassword\n084b2fca0b434f189358123412312313113<\/code><\/pre>\n<p>\u628a\u5bc6\u7801\u590d\u5236\u51fa\u6765\uff0c\u7528\u4e8e\u767b\u5f55jenkins<\/p>\n<h2><strong>4.\u9009\u62e9\u63d2\u4ef6\uff0c\u5b89\u88c5jenkins\uff0c\u7b49\u5f85\u5373\u53ef\u5b8c\u6210<\/strong><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-270 size-full\" src=\"https:\/\/yinyubo-1257235934.cos.ap-nanjing.myqcloud.com\/content\/Image-10.png\" alt=\"\" width=\"982\" height=\"893\" \/><br \/>\n\u5b8c\u6210\u4e4b\u540e\uff0c\u8f93\u5165\u81ea\u5df1\u7684\u7cfb\u7edf\u7ba1\u7406\u5458\u7528\u6237\u540d\u5bc6\u7801\u5c31\u597d\u5566~\u672c\u6b21\u8bfe\u7a0b\u7ed3\u675f~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u62c9\u53d6docker hub\u4e0a\u7684jenkins\u955c\u50cf\uff0c\u5e76\u4e14\u8fd0\u884c \u53c2\u8003https:\/\/jenkins.io\/doc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-268","post","type-post","status-publish","format-standard","hentry","category-k8s"],"_links":{"self":[{"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/posts\/268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=268"}],"version-history":[{"count":1,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/posts\/268\/revisions"}],"predecessor-version":[{"id":879,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=\/wp\/v2\/posts\/268\/revisions\/879"}],"wp:attachment":[{"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yinyubo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}