暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Docker 安装

DB小榴莲 2021-06-27
935

Docker

获取docker介质

Get Docker这里介绍了如何获取docker安装介质,可以在苹果Mac OS,Windows,Linux上安装Docker,根据自己需要的平台选择安装介质和安装方法。

Docker介绍

Docker在其他Linux分支上的安装说明

  • Debian

    Debian是一款完全自由的操作系统,基于Debian衍生出来的很多操作系统如:“BunsenLabs Linux”, “Kali Linux” ,“LMDE”,对于在这些操作系统上的安装,具体要参照Debian的说明。

  • Ubuntu

    Ubuntu的一些衍生操作系统如:“Kubuntu”, “Lubuntu”,“Xubuntu”,docker在这些系统上的安装也是需要根据他们自身的说明来进行。

  • Linux

    一些Linux发行版通过其包存储库提供向用户提供Docker引擎。

Docker分支版本

  • Stable

    稳定版,发版号格式为<年>.<月>,比如19.03,代表19年3月份,当稳定版发布,后面发布的版本号将会延续这个主版本号,比如,19.03.xx。

  • Test

    测试版,在发布GA(general availability)版本之前,会发布test版供用户测试。

  • Nightly

    轻量版,个人理解,这是一个内部开发版本号,每天都有不同的版本,并且版本号是通过哈希得到的。下面是官方对它的解释

    Nightly builds give you the latest builds of work in progress for the next major release. They are created once per day from the master branch with the version format:

    0.0.0-YYYYmmddHHMMSS-abcdefabcdef
    复制

    where the time is the commit time in UTC and the final suffix is the prefix of the commit hash, for example 0.0.0-20180720214833-f61e0f7
    .

    These builds allow for testing from the latest code on the master branch. No qualifications or guarantees are made for the nightly builds.

安装Docker

本文选择Docker for Linux的安装,以下是安装测试过程。

操作系统要求

至少是Centos7 或者 8版本的操作系统,之前的旧版本不支持。

开启centos-extras
,推荐安装overlay2
存储驱动。

在CentOS 5和6中,为CentOS提供附加功能的包,而不会破坏上游兼容性或更新基本组件。在CentOS 7和8中,这是一个上游存储库,以及附加的CentOS包。CentOS开发团队已在此存储库中测试了每个项目,他们都与CentOS合作。此存储库使用CentOS附带,默认情况下启用。

卸载系统中老版本docker

 sudo yum remove docker \                  docker-client \                  docker-client-latest \                  docker-common \                  docker-latest \                  docker-latest-logrotate \                  docker-logrotate \                  docker-engine
复制

[root@localhost ~]# yum -y install yum-utils \> device-mapper-persistent-data \> lvm2Loaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.ustc.edu.cn * extras: mirrors.cqu.edu.cn * updates: mirrors.ustc.edu.cnResolving Dependencies--> Running transaction check---> Package device-mapper-persistent-data.x86_64 0:0.8.5-2.el7 will be updated......省略部分........                  Complete!
复制

[root@localhost ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo Loaded plugins: fastestmirror, langpacksadding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repograbbing file https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to etc/yum.repos.d/docker-ce.reporepo saved to etc/yum.repos.d/docker-ce.repo
复制

[root@localhost yum.repos.d]# yum updateLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.ustc.edu.cn * extras: mirrors.cqu.edu.cn * updates: mirrors.ustc.edu.cndocker-ce-stable                                                                                                                                            | 3.5 kB  00:00:00     (1/2): docker-ce-stable/7/x86_64/updateinfo                                                                                                                 |   55 B  00:00:00     (2/2): docker-ce-stable/7/x86_64/primary_db                                                                                                                 |  62 kB  00:00:00     Resolving Dependencies--> Running transaction check---> Package ModemManager.x86_64 0:1.6.10-3.el7_6 will be updated---> Package ModemManager.x86_64 0:1.6.10-4.el7 will be an update.......省略部分.......
复制

[root@localhost yum.repos.d]# yum install docker-ceLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.ustc.edu.cn * extras: mirrors.cqu.edu.cn * updates: mirrors.ustc.edu.cnResolving Dependencies--> Running transaction check---> Package docker-ce.x86_64 3:20.10.7-3.el7 will be installed--> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-20.10.7-3.el7.x86_64........省略部分........
复制

[root@localhost yum.repos.d]# systemctl status docker● docker.service - Docker Application Container Engine   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)   Active: inactive (dead)     Docs: https://docs.docker.com
复制

[root@localhost yum.repos.d]# systemctl start docker[root@localhost yum.repos.d]# systemctl status docker● docker.service - Docker Application Container Engine   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)   Active: active (running) since Thu 2021-06-03 23:08:13 CST; 4s ago     Docs: https://docs.docker.com Main PID: 21508 (dockerd)    Tasks: 8   Memory: 44.8M   CGroup: system.slice/docker.service           └─21508 usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sockJun 03 23:08:12 localhost.localdomain dockerd[21508]: time="2021-06-03T23:08:12.701942913+08:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///r...odule=grpcJun 03 23:08:12 localhost.localdomain dockerd[21508]: time="2021-06-03T23:08:12.701947831+08:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpcJun 03 23:08:12 localhost.localdomain dockerd[21508]: time="2021-06-03T23:08:12.726250202+08:00" level=info msg="Loading containers: start."Jun 03 23:08:12 localhost.localdomain dockerd[21508]: time="2021-06-03T23:08:12.980496785+08:00" level=info msg="Default bridge (docker0) is assigned with an IP addre...P address"Jun 03 23:08:13 localhost.localdomain dockerd[21508]: time="2021-06-03T23:08:13.054847821+08:00" level=info msg="Firewalld: interface docker0 already part of docker z...returning"Jun 03 23:08:13 localhost.localdomain dockerd[21508]: time="2021-06-03T23:08:13.100822719+08:00" level=info msg="Loading containers: done."Jun 03 23:08:13 localhost.localdomain dockerd[21508]: time="2021-06-03T23:08:13.112943855+08:00" level=info msg="Docker daemon" commit=b0f5bc3 graphdriver(s)=overlay2...on=20.10.7Jun 03 23:08:13 localhost.localdomain dockerd[21508]: time="2021-06-03T23:08:13.113171273+08:00" level=info msg="Daemon has completed initialization"Jun 03 23:08:13 localhost.localdomain systemd[1]: Started Docker Application Container Engine.Jun 03 23:08:13 localhost.localdomain dockerd[21508]: time="2021-06-03T23:08:13.141598332+08:00" level=info msg="API listen on var/run/docker.sock"Hint: Some lines were ellipsized, use -l to show in full.
复制

安装过程中遇到的问题总结

yum源选择

[root@localhost ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
复制

通过这条命令获取的是阿里的yum镜像,用这个镜像源来安装docker,缺依赖包。在/etc/yum.repos.d/docker-ce.repo文件首添加如下内容,将镜像源换到centos.org。

name=Centos extras - $basearchbaseurl=http://mirror.centos.org/centos/7/extras/x86_64enabled=1gpgcheck=0priority=1
复制


----------------------------
长按下图二维码关注我,每篇涨点小知识!





文章转载自DB小榴莲,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论