jenkins自動打包部署到指定目錄

來龍去脈

最近工做不忙,研究一下自動化打包,要實現的目標是經過jenkins自動打包,拷貝到指定目錄html

目標

git更新了代碼,jenkins自動打包部署linux

第一部 安裝jenkins

看了一下文檔jenkins居然須要Docker安裝....驚呆了🤯git

安裝Docker

  1. 安裝依賴包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
  1. 添加docker-ce yum倉庫

用的阿里的源docker

sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

報錯:centos

已加載插件:fastestmirror
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 416 Requested Range Not Satisfiable"
嘗試其餘鏡像。
Could not fetch/save url http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to file /etc/yum.repos.d/docker-ce.repo: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 416 Requested Range Not Satisfiable"

查了一下 有說改源的,有改配置文件的,實際上是在:/etc/yum.repos.d下發現已經有了一個docker-ce.repo 文件 刪掉就能夠了app

而後繼續報錯 ,缺乏一堆包,運維

踩坑記,必定要先查看本身系統的版本,咱們的版本是CentOS6.8 新的版本須要的是CentOS 7 至於咱們運維爲何裝這麼老的系統不得而知,我感受後邊還要坑我

CentOS6.8 上安裝docker

mmp!
參考:http://www.cnblogs.com/zhenyu...
安裝epelide

rpm -iUvh http://dl.fedoraproject.org/p...
安裝dockerfetch

yum install docker-io
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                                                                                                                                                          | 6.2 kB     00:00     
 * base: mirrors.aliyun.com
 * epel: mirrors.ustc.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.sohu.com
epel                                                                                                                                                                                                                                                   | 4.3 kB     00:00     
epel/primary_db                                                                                                                                                                                                                                        | 5.9 MB     00:01     
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:1.7.1-2.el6 will be installed
--> Processing Dependency: lxc for package: docker-io-1.7.1-2.el6.x86_64
--> Running transaction check
---> Package lxc.x86_64 0:1.0.10-2.el6 will be installed
--> Processing Dependency: lua-lxc(x86-64) = 1.0.10-2.el6 for package: lxc-1.0.10-2.el6.x86_64
--> Processing Dependency: lua-alt-getopt for package: lxc-1.0.10-2.el6.x86_64
--> Processing Dependency: liblxc.so.1()(64bit) for package: lxc-1.0.10-2.el6.x86_64
--> Running transaction check
---> Package lua-alt-getopt.noarch 0:0.7.0-1.el6 will be installed
---> Package lua-lxc.x86_64 0:1.0.10-2.el6 will be installed
--> Processing Dependency: lua-filesystem for package: lua-lxc-1.0.10-2.el6.x86_64
---> Package lxc-libs.x86_64 0:1.0.10-2.el6 will be installed
--> Processing Dependency: rsync for package: lxc-libs-1.0.10-2.el6.x86_64
--> Running transaction check
---> Package lua-filesystem.x86_64 0:1.4.2-1.el6 will be installed
---> Package rsync.x86_64 0:3.0.6-12.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================================================================================================
 Package                                Arch                        Version                          Repository                                                   Size
=====================================================================================================================================================================================================
Installing:
 docker-io                             x86_64                      1.7.1-2.el6                      epel                                                        4.6 M
Installing for dependencies:
 lua-alt-getopt                       noarch                       0.7.0-1.el6                      epel                                                        6.9 k
 lua-filesystem                       x86_64                       1.4.2-1.el6                      epel                                                         24 k
 lua-lxc                              x86_64                       1.0.10-2.el6                     epel                                                         16 k
 lxc                                  x86_64                       1.0.10-2.el6                     epel                                                        124 k
 lxc-libs                             x86_64                       1.0.10-2.el6                     epel                                                        258 k
 rsync                                x86_64                       3.0.6-12.el6                     base                                                        335 k

Transaction Summary
=====================================================================================================================================================================================================
Install       7 Package(s)

Total download size: 5.3 M
Installed size: 21 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): docker-io-1.7.1-2.el6.x86_64.rpm                                                                                                                                                                                                                | 4.6 MB     00:04     
(2/7): lua-alt-getopt-0.7.0-1.el6.noarch.rpm                                                                                                                                                                                                           | 6.9 kB     00:00     
(3/7): lua-filesystem-1.4.2-1.el6.x86_64.rpm                                                                                                                                                                                                           |  24 kB     00:00     
(4/7): lua-lxc-1.0.10-2.el6.x86_64.rpm                                                                                                                                                                                                                 |  16 kB     00:00     
(5/7): lxc-1.0.10-2.el6.x86_64.rpm                                                                                                                                                                                                                     | 124 kB     00:00     
(6/7): lxc-libs-1.0.10-2.el6.x86_64.rpm                                                                                                                                                                                                                | 258 kB     00:00     
(7/7): rsync-3.0.6-12.el6.x86_64.rpm                                                                                                                                                                                                                   | 335 kB     00:00     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                         502 kB/s | 5.3 MB     00:10     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
 Userid : EPEL (6) <epel@fedoraproject.org>
 Package: epel-release-6-8.noarch (installed)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : lua-filesystem-1.4.2-1.el6.x86_64                                                                                                                                                                                                                          1/7 
  Installing : lua-alt-getopt-0.7.0-1.el6.noarch                                                                                                                                                                                                                          2/7 
  Installing : rsync-3.0.6-12.el6.x86_64                                                                                                                                                                                                                                  3/7 
  Installing : lxc-libs-1.0.10-2.el6.x86_64                                                                                                                                                                                                                               4/7 
  Installing : lua-lxc-1.0.10-2.el6.x86_64                                                                                                                                                                                                                                5/7 
  Installing : lxc-1.0.10-2.el6.x86_64                                                                                                                                                                                                                                    6/7 
  Installing : docker-io-1.7.1-2.el6.x86_64                                                                                                                                                                                                                               7/7 
  Verifying  : lua-lxc-1.0.10-2.el6.x86_64                                                                                                                                                                                                                                1/7 
  Verifying  : lxc-libs-1.0.10-2.el6.x86_64                                                                                                                                                                                                                               2/7 
  Verifying  : lxc-1.0.10-2.el6.x86_64                                                                                                                                                                                                                                    3/7 
  Verifying  : docker-io-1.7.1-2.el6.x86_64                                                                                                                                                                                                                               4/7 
  Verifying  : rsync-3.0.6-12.el6.x86_64                                                                                                                                                                                                                                  5/7 
  Verifying  : lua-alt-getopt-0.7.0-1.el6.noarch                                                                                                                                                                                                                          6/7 
  Verifying  : lua-filesystem-1.4.2-1.el6.x86_64                                                                                                                                                                                                                          7/7 

Installed:
  docker-io.x86_64 0:1.7.1-2.el6                                                                                                                                                                                                                                              

Dependency Installed:
  lua-alt-getopt.noarch 0:0.7.0-1.el6              lua-filesystem.x86_64 0:1.4.2-1.el6              lua-lxc.x86_64 0:1.0.10-2.el6              lxc.x86_64 0:1.0.10-2.el6              lxc-libs.x86_64 0:1.0.10-2.el6              rsync.x86_64 0:3.0.6-12.el6             

Complete!

注意:
最docker-1.10之後完全放棄了lxc轉而使用libcontainer(go).建議安裝最新的docker使用centos7.this

這樣docker 安裝成功
來繼續Jenkins

sudo docker pull jenkins
2019/09/19 15:50:16 Can't connect to docker daemon. Is 'docker -d' running on this host?

沒解決方案,放棄了 感受是防火牆之類的問題 隔絕了服務,
考慮直接安裝Jenkins

直接安裝Jenkins 就簡單多了

sudo yum install jenkins
sudo service jenkins start

就啓動了 jenkins 服務

相關文章
相關標籤/搜索