前因后果
最近工作不忙,研究一下自动化打包,要实现的目标是通过jenkins自动打包,拷贝到指定目录
目标
git更新了代码,jenkins自动打包部署
第一部 安装jenkins
看了一下文档jenkins竟然需要Docker安装....惊呆了????
安装Docker
- 安装依赖包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
- 添加docker-ce yum仓库
用的阿里的源
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
报错:
已加载插件:fastestmirroradding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repograbbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repohttp://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 文件 删掉就可以了
然后继续报错 ,缺少一堆包,
踩坑记,一定要先查看自己系统的版本,我们的版本是CentOS6.8 新的版本需要的是CentOS 7 至于我们运维为什么装这么老的系统不得而知,我感觉后边还要坑我
CentOS6.8 上安装docker
mmp!
参考:http://www.cnblogs.com/zhenyu...
安装epel
rpm -iUvh http://dl.fedoraproject.org/p...
安装docker
yum install docker-ioLoaded plugins: fastestmirrorSetting up Install ProcessLoading mirror speeds from cached hostfileepel/metalink | 6.2 kB 00:00 * base: mirrors.aliyun.com * epel: mirrors.ustc.edu.cn * extras: mirrors.aliyun.com * updates: mirrors.sohu.comepel | 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 ResolutionDependencies Resolved============================================================================================================================================================================================================================================================================== Package Arch Version Repository Size=====================================================================================================================================================================================================Installing: docker-io x86_64 1.7.1-2.el6 epel 4.6 MInstalling 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 kTransaction Summary=====================================================================================================================================================================================================Install 7 Package(s)Total download size: 5.3 MInstalled size: 21 MIs this ok [y/N]: yDownloading 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: NOKEYRetrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6Importing 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-6Is this ok [y/N]: yRunning rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionWarning: 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.
这样docker 安装成功
来继续Jenkins
sudo docker pull jenkins2019/09/19 15:50:16 Can't connect to docker daemon. Is 'docker -d' running on this host?
没解决方案,放弃了 感觉是防火墙之类的问题 隔绝了服务,
考虑直接安装Jenkins
直接安装Jenkins 就简单多了
sudo yum install jenkinssudo service jenkins start
就启动了 jenkins 服务