CentOS 7

CentOS7下的各种应用


04_CentOS 7安装docker(arm64)

<h1>环境说明</h1> <table> <thead> <tr> <th>类别</th> <th>详细信息</th> </tr> </thead> <tbody> <tr> <td>服务器</td> <td>华为TaiShan2280 鲲鹏920 arm64芯片</td> </tr> <tr> <td>操作系统</td> <td>CentOS Linux release 7.8.2003 (AltArch)</td> </tr> <tr> <td>虚拟化平台</td> <td>FusionCompute_VRM-8.0.0-ARM_64</td> </tr> </tbody> </table> <h1>一、准备工作</h1> <h2>1.系统要求</h2> <p>Docker CE 支持 64 位版本 CentOS 7,并且要求内核版本不低于 3.10。</p> <p>CentOS 7满足最低内核的要求,但由于内核版本比较低,部分功能(如 overlay2 存储层驱动)无法使用,并且部分功能可能不太稳定。</p> <h2>2.鲲鹏920架构arm64版本的centos7可以,查看命令如下:</h2> <pre><code class="language-bash">hostnamectl</code></pre> <pre><code class="language-bash"> Static hostname: miaoyun169.zyzh.com Icon name: computer-vm Chassis: vm Machine ID: a42eb0913e0e49eeaced03a5079a442b Boot ID: c8db84797fd6483ba6b806e4da01dac7 Virtualization: kvm Operating System: CentOS Linux 7 (AltArch) CPE OS Name: cpe:/o:centos:centos:7:server Kernel: Linux 4.18.0-193.1.2.el7.aarch64 Architecture: arm64</code></pre> <h2>3.卸载旧版本</h2> <p>旧版本的 Docker 称为 docker 或者 docker-engine ,使用以下命令卸载旧版本:</p> <pre><code class="language-bash">yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine</code></pre> <h2>4.配置 Docker YUM 源</h2> <pre><code class="language-bash">vim /etc/yum.repos.d/docker-ce.repo</code></pre> <p>添加如下内容: 都换成阿里的</p> <pre><code class="language-bash">[docker-ce-stable] name=Docker CE Stable - $basearch baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/stable enabled=1 gpgcheck=1 gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg [docker-ce-stable-debuginfo] name=Docker CE Stable - Debuginfo $basearch baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/stable enabled=0 gpgcheck=1 gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg [docker-ce-stable-source] name=Docker CE Stable - Sources baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/stable enabled=0 gpgcheck=1 gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg [docker-ce-edge] name=Docker CE Edge - $basearch baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/edge enabled=0 gpgcheck=1 gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg [docker-ce-edge-debuginfo] name=Docker CE Edge - Debuginfo $basearch baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/edge enabled=0 gpgcheck=1 gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg [docker-ce-edge-source] name=Docker CE Edge - Sources baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/edge enabled=0 gpgcheck=1 gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg [docker-ce-test] name=Docker CE Test - $basearch baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/test enabled=0 gpgcheck=1 gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg [docker-ce-test-debuginfo] name=Docker CE Test - Debuginfo $basearch baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/test enabled=0 gpgcheck=1 gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg [docker-ce-test-source] name=Docker CE Test - Sources baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/test enabled=0 gpgcheck=1 gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg [docker-ce-nightly] name=Docker CE Nightly - $basearch baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/nightly enabled=0 gpgcheck=1 gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg [docker-ce-nightly-debuginfo] name=Docker CE Nightly - Debuginfo $basearch baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/nightly enabled=0 gpgcheck=1 gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg [docker-ce-nightly-source] name=Docker CE Nightly - Sources baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/nightly enabled=0 gpgcheck=1 gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg</code></pre> <h2>5.更新yum源缓存</h2> <pre><code class="language-bash">yum makecache fast</code></pre> <pre><code class="language-bash">Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.bfsu.edu.cn * extras: mirrors.bfsu.edu.cn * updates: mirrors.bfsu.edu.cn base | 3.6 kB 00:00:00 docker-ce-stable | 3.5 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/2): docker-ce-stable/aarch64/updateinfo | 55 B 00:00:00 (2/2): docker-ce-stable/aarch64/primary_db | 36 kB 00:00:00 Metadata Cache Created</code></pre> <h2>6.查看yum仓库列表</h2> <pre><code class="language-bash">yum repolist</code></pre> <pre><code class="language-bash">Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.bfsu.edu.cn * extras: mirrors.bfsu.edu.cn * updates: mirrors.bfsu.edu.cn repo id repo name status base/7/aarch64 CentOS-7 - Base 7,622 docker-ce-stable/aarch64 Docker CE Stable - aarch64 67 extras/7/aarch64 CentOS-7 - Extras 418 updates/7/aarch64 CentOS-7 - Updates 839 repolist: 8,946</code></pre> <h2>7.安装依赖包</h2> <pre><code class="language-bash">yum install -y yum-utils \ device-mapper-persistent-data \ lvm2</code></pre> <h2>8.开始安装docker-ce</h2> <p>安装最新docker-ce</p> <pre><code class="language-bash">yum -y install docker-ce</code></pre> <p>卸载docker yum remove docker-ce docker-ce-cli containerd.io rm -rf /usr/bin/containerd rm -rf /usr/bin/containerd-shim rm -rf /usr/bin/docker* rm -rf /usr/bin/ctr rm -rf /usr/bin/runc 安装指定版本</p> <pre><code class="language-bash">yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum list docker-ce --showduplicates|sort -r yum -y install docker-ce-19.03.13-3.el7 docker-ce-cli-19.03.13 containerd.io-1.3.7-3.1 systemctl daemon-reload systemctl restart docker systemctl enable docker</code></pre> <h2>9.启动docker并设置随机启动</h2> <pre><code class="language-bash">systemctl start docker systemctl enable docker</code></pre> <h2>10.查看docker版本</h2> <pre><code class="language-bash">docker -v #或 docker info</code></pre> <h2>11.搜索镜像</h2> <pre><code class="language-bash">docker search centos</code></pre> <p>centos:latest是8版本</p> <h2>12.拉取镜像</h2> <p>拉取镜像前,先</p> <pre><code class="language-bash">docker pull centos #这样拉取的是centos8</code></pre> <pre><code class="language-bash">docker pull centos:7</code></pre> <p>来源: <a href="https://blog.csdn.net/frdevolcqzyxynjds/article/details/105870849">https://blog.csdn.net/frdevolcqzyxynjds/article/details/105870849</a></p>

页面列表

ITEM_HTML