クラウドホストにDocker-CEをインストールした経験のまとめ

3192 ワード

最近docker容器を研究して、ここでdockerの取り付け過程と出会った問題を記録して、本人は初心者で、噴き出すのが好きではありません.
ホスト環境:テンセントクラウドホスト-centos 7.2 64ビット
カーネルバージョン:3.10
チュートリアル:https://legacy.gitbook.com/book/yeasy/docker_practice/details
最初のステップは、dockerをインストールしていない場合はスキップして、古いバージョンをアンインストールします.公式ドキュメントの説明によると、Docker-CEは64ビットのcentos 7をサポートしています.カーネルバージョンは3.10を下回ってはいけません.このバージョンはカーネルが低く、一部の機能は使用できません.また、一部の機能は安定していない可能性があります.一時的に個人学習のみで使用し、無視します.コマンドの実行
$ sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine

この命令は1行の命令内で完了したほうがよいが,公式文書から与えられた命令は複数行に分かれ,BUGが発生した.
ステップ2では、dockerのインストールにはyumコマンドが必要です.yumコマンドのインストールコマンドは次のとおりです.
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
強力な壁のため、ここでは国内のソースに変更する必要があります.
$ sudo yum-config-manager --add-repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo

dockerの公式ソースは以下の通りです.
 $ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo 

最新バージョンのDocker CEを使用:
$ sudo yum-config-manager --enable docker-ce-edge

ステップ3でDocker CEのインストールを開始
まずyumソフトウェアソースのキャッシュを更新し、docker-ceをインストールします.
$ sudo yum makecache fast
$ sudo yum install docker-ce

ステップ4、Docker CEを起動
$ sudo systemctl enable docker
$ sudo systemctl start docker

第五部、ユーザーグループを創立する
dockerグループの作成
$ sudo groupadd docker

現在のユーザーをdockerグループに追加
$ sudo usermod -aG docker zdd123

第六部、これでインストールが完了しました.次にインストールが成功したかどうかをテストします.
$ docker run hello-world

次に、コンソールからインストールに成功したことを示す出力が表示されます.
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

これでインストール完了!
問題:
1
No packages in any requested group available to install or update

yum clean allを実行し、操作を続行します.
2.No package docker-ce available.公式ドキュメントから与えられた命令は複数行で、真ん中に「/」が多くなったら、「/」を削除し、1行に統合すればよい.