dockerをインストールするためのシンプルで失礼な8つのステップ

目次

1.環境ビュー

2.古いバージョンのdockerをアンインストールします

 3.必要なインストールパッケージをダウンロードします

4.ミラーウェアハウスをセットアップします

 5.ドッカーエンジンを取り付けます。

6.dockerを起動します

7.dockerが正常にインストールされているかどうかを確認します

 8.hello-worldイメージを実行します


1.環境ビュー

#查看内核 内核是3.10及以上
uname -r

[root@localhost mengming]# uname -r
3.10.0-1062.el7.x86_64
# 系统版本centos7及以上
cat /etc/os-release 
[root@localhost mengming]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

2.古いバージョンのdockerをアンインストールします

yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

 3.必要なインストールパッケージをダウンロードします

yum install -y yum-utils

4.ミラーウェアハウスをセットアップします

yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo #默认是国外的

アリババクラウドへの変更をお勧めします

yum-config-manager \
     --add-repo \
     http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

 5.ドッカーエンジンを取り付けます。注:インストールする前に、yumパッケージのインデックスを更新してください

yum makecache fast

yum install docker-ce docker-ce-cli containerd.io

6.dockerを起動します

systemctl start docker

 

7.dockerが正常にインストールされているかどうかを確認します

docker version

 

 8.hello-worldイメージを実行します

docker run hello-world

 

おすすめ

転載: blog.csdn.net/qq_31702609/article/details/106243538