Antecedents and consequences
Recently, I'm not busy with my work. I'm going to study automated packaging. The goal is to package automatically through jenkins and copy it to a specified directory.
target
git updates the code and jenkins automatically packages and deploys
First install jenkins
Look at the document jenkins need Docker installation... Amazed.
Install Docker
- Install dependency packages
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
- Add docker-ce yum repository
Source of Ali used
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Report errors:
Loaded plug-in: 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" //Try other mirrors. 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"
Check the source and configuration files that have been changed. In fact, it is found that a docker-ce.repo file has been deleted under / etc/yum.repos.d.
Then continue to report errors, missing a bunch of packages.
First, we must check the version of our system. Our version is a new version of CentOS6.8. What we need is CentOS 7. As for why our operation and maintenance system is so old, it is not known. I feel there is pit behind me.
Install docker on CentOS 6.8
mmp!
Reference resources: http://www.cnblogs.com/zhenyu...
Install epel
rpm -iUvh http://dl.fedoraproject.org/p...
Install docker
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!
Be careful:
After the most docker-1.10, lxc was completely abandoned and libcontainer(go) was used instead. It is recommended that centos7 be used to install the latest docker.
So the docker installation is successful
To continue Jenkins
sudo docker pull jenkins 2019/09/19 15:50:16 Can't connect to docker daemon. Is 'docker -d' running on this host?
No solution, give up the feeling that it's a firewall or something that isolates the service.
Consider installing Jenkins directly
It's much easier to install Jenkins directly.
sudo yum install jenkins sudo service jenkins start
The jenkins service was launched