CentOS 7安装Docker-CE 18.06

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:538

[font="]一、在线安装步骤[font="]1[font="]、安装依赖包[font="]yum -y[font="] install yum-utils[font="]device-mapper-persistent-data[font="] lvm2[font="]2[font="]、安装docker[font="]yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo[font="] #[font="]配置安装源[font="]yum list docker-ce.x86_64--showduplicates | sort -r #[font="]查看docker版本[font="]yum makecache fast && yum -yinstall docker-ce-18.06.0.ce-3.el7 #[font="]安装docker 指定版本 [font="]3[font="]、设置阿里云加速[font="]mkdir -p /etc/docker[font="] [font="] [font="]tee /etc/docker/daemon.json <<-'EOF'[font="]{[font="] "hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"],[font="] "registry-mirrors": ["https://tgv7oaqr.mirror.aliyuncs.com"][font="]}[font="]EOF [font="]4[font="]、设置开机启动及启动docker[font="]#[font="]启动docker[font="]systemctldaemon-reload && systemctl restart docker [font="]#[font="]设置开机启动[font="]systemctlenable docker.service[font="]#[font="]验证[font="]docker run --rm busybox echo "hello world" [font="]二、离线安装步骤[font="]1[font="]、下载相关安装包[font="]下载docker-ce:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-18.06.1.ce-3.el7.x86_64.rpm[font="]下载container-selinux:http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.68-1.el7.noarch.rpm[font="]下载audit-libs-python:ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/7.5/x86_64/os/Packages/audit-libs-python-2.8.1-3.el7.x86_64.rpm[font="]下载libtool-ltdl:http://www.rpmfind.net/linux/centos/7.5.1804/os/x86_64/Packages/libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm[font="]下载policycoreutils-python:ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/7.5/x86_64/os/Packages/policycoreutils-python-2.5-22.el7.x86_64.rpm[font="]下载checkpolicy:ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/7.5/x86_64/os/Packages/checkpolicy-2.5-6.el7.x86_64.rpm[font="]下载libcgroup:ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/7.5/x86_64/os/Packages/libcgroup-0.41-15.el7.x86_64.rpm[font="]下载libsemanage-python:ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/7.2/x86_64/updates/security/libsemanage-python-2.5-11.el7.x86_64.rpm[font="]下载python-IPy:ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/7.2/x86_64/os/Packages/python-IPy-0.75-6.el7.noarch.rpm[font="]下载setools-libs:ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/7.2/x86_64/updates/security/setools-libs-3.3.8-2.el7.x86_64.rpm[font="]下载libseccomp:ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/7.5/x86_64/os/Packages/libseccomp-2.3.1-3.el7.x86_64.rpm[font="] [font="]除docker-ce外的所有安装包均可在如下网站搜索下载:http://rpm.pbone.net/index.php3[font="] [font="]2[font="]、上传安装包至服务器[font="]使用FileZilla软件上传安装包至服务器root目录下,如下图: [font="]上传完成后,在服务器查看安装包,如下: [font="]3[font="]、安装docker-ce[font="]方法一:单个顺序安装依赖包[font="]请按如下顺序安装依赖包:[font="]rpm-ivh libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm #[font="]一般会提示该包已安装,但保险起见最好还是安装一遍 [font="]rpm-ivh audit-libs-python-2.8.1-3.el7.x86_64.rpm[font="]rpm-ivh libcgroup-0.41-15.el7.x86_64.rpm [font="]rpm-ivh libsemanage-python-2.5-11.el7.x86_64.rpm [font="]rpm-ivh checkpolicy-2.5-6.el7.x86_64.rpm[font="]rpm-ivh python-IPy-0.75-6.el7.noarch.rpm[font="]rpm-ivh setools-libs-3.3.8-2.el7.x86_64.rpm[font="]rpm-ivh policycoreutils-python-2.5-22.el7.x86_64.rpm[font="]rpm-ivh container-selinux-2.68-1.el7.noarch.rpm [font="]rpm-ivh libseccomp-2.3.1-3.el7.x86_64.rpm[font="]rpm-ivh docker-ce-18.06.1.ce-3.el7.x86_64.rpm [font="]方法二:批量安装依赖包[font="]编写安装脚本,给脚本授权,执行脚本,如下图:[font="]脚本文件: [font="]4[font="]、设置开机启动及启动docker[font="]#[font="]启动docker[font="]systemctldaemon-reload && systemctl restart docker [font="]#[font="]设置开机启动[font="]systemctlenable docker.service [font="]#[font="]验证docker[font="]dockerps [font="]列出所有运行中容器[font="]dockerps -a [font="]列出所有容器(包含沉睡/退出状态的容器)[font="]dockerversion [font="]查看docker的版本

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】