一、rpm离线安装docker17.12
1.下载docker安装包
在https://download.docker.com/linux/centos/7/x86_64/stable/Packages/下载docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm
2.下载9个依赖
在http://mirrors.163.com/centos/7/os/x86_64/Packages/下载8个依赖
audit-libs-python-2.7.6-3.el7.x86_64.rpm
checkpolicy-2.5-4.el7.x86_64.rpm
libcgroup-0.41-13.el7.x86_64.rpm
libseccomp-2.3.1-3.el7.x86_64.rpm
libsemanage-python-2.5-8.el7.x86_64.rpm
policycoreutils-python-2.5-17.1.el7.x86_64.rpm
python-IPy-0.75-6.el7.noarch.rpm
setools-libs-3.3.8-1.1.el7.x86_64.rpm
在http://rpm.pbone.net/index.php3?stat=3&limit=1&srodzaj=1&dl=40&search=container-selinux&field[]=1&field[]=2下载container-selinux-2.9-4.el7.noarch.rpm
下载链接:ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/7x/external_products/extras/x86_64/container-selinux-2.9-4.el7.noarch.rpm
3.安装
将8个依赖复制到服务器上如:/root/docker/
将docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm和container-selinux-2.9-4.el7.noarch.rpm复制到/root/docker/rpm/
rpm -ivh /root/docker/*.rpm
rpm -ivh /root/docker/rpm/container-selinux-2.9-4.el7.noarch.rpm
rpm -ivh/root/docker/rpm/docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm
4.启动
service dockerstart
docker -v
二、静态二进制文件离线安装docker17.12
参考https://docs.docker.com/install/linux/docker-ce/binaries/#install-static-binaries
1.下载静态二进制档案
转到https://download.docker.com/linux/static/stable/(或更改stable为edge或test),选择您的硬件平台,然后下载.tgz与要安装的Docker CE版本相关的文件。
2.解压
$ tar xzvf/path/to/<FILE>.tar.gz
可选:将二进制文件移动到可执行文件路径上的某个目录,例如/usr/bin/。
$ sudo cpdocker/* /usr/bin/
3.启动Docker守护进程:
$ sudo dockerd&
4.启动docker
docker -v
三、离线安装docker1.7.1(早期版本)
参考https://www.iyunv.com/thread-149007-1-1.html
1.下载离线安装包
docker安装包:https://get.docker.com/rpm/1.7.1/centos-7/RPMS/x86_64/docker-engine-1.7.1-1.el7.centos.x86_64.rpm
依赖组件cgroup:http://mirrors.163.com/centos/7/os/x86_64/Packages/
libcgroup-0.41-8.el7.x86_64.rpm
libcgroup-devel-0.41-8.el7.x86_64.rpm
libcgroup-pam-0.41-8.el7.x86_64.rpm
libcgroup-tools-0.41-8.el7.x86_64.rpm
2.先安装组件依赖
su
rpm -ivhlibcgroup-*
3.安装docker
rpm -ivhdocker-engine-1.7.1-1.el7.centos.x86_64.rpm
4.启动docker
service docker start
docker -v
四、离线安装docker私库
1.准备离线镜像
在有网的docker服务器上执行:
docker pull registry
docker save registry > registry.tar
2.加载离线镜像
在正式服务器上执行:
docker load < registry.tar
3.仓库认证
mkdir -p /docker-hub/auth
cd /docker-hub/
用户名admin,密码2018@Better
docker run --entrypoint htpasswd registry -Bbn admin 2018@Better>auth/htpasswd
4.启动
docker run -d -p 5000:5000--restart=always --name docker-hub \
-v/docker-hub/registry:/var/lib/registry \
-v /docker-hub/auth:/auth \
-e"REGISTRY_AUTH=htpasswd" \
-e"REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-eREGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
registry
5.验证
查看私库上的镜像
http://10.100.50.60:5000/v2/_catalog
查看某个镜像的标签
http://10.100.50.60:5000/v2/spring-cloud-eureka/tags/list
五、卸载docker
1.列出安装包
yum listinstalled | grep docker
2.删除安装包
yum -y removedocker-xxx
3.删除镜像/容器等
rm -rf/var/lib/docker