Dockerの手動インストール詳細チュートリアル

Dockerの手動インストール詳細チュートリアル

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

古いバージョンのDockerは、docker、docker.io、またはdocker-engineと呼ばれます。それらがインストールされている場合は、それらをアンインストールします。

sudo apt-get remove docker docker-engine docker.io containerd runc

現在のdockerパッケージはDockerEngine-Communityと呼ばれ、省略形はdocker-ceです。

2.Dockerウェアハウスを使用してインストールします

Docker Engine-Communityを新しいホストに初めてインストールする前に、Dockerリポジトリをセットアップする必要があります。その後、リポジトリからDockerをインストールして更新できます。

2.1倉庫を設置する

aptパッケージインデックスを更新します。

sudo apt-get update

apt依存関係パッケージをインストールして、HTTPS経由でウェアハウスを取得します。

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

Dockerの公式GPGキーを追加します。

curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

sudo apt-key fingerprint 0EBFCD88
输出:
pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <[email protected]>
sub   rsa4096 2017-02-22 [S]

次の手順を使用して、ウェアハウスの安定バージョンをセットアップします。

sudo add-apt-repository \
 "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/ \
  $(lsb_release -cs) \
 stable"

2.2 DockerEngineのインストール-コミュニティ

aptパッケージインデックスを更新します。

sudo apt-get update

Docker Engine-Community and containerdの最新バージョンをインストールするか、次の手順に進んで特定のバージョンをインストールします。

sudo apt-get install docker-ce docker-ce-cli containerd.io

Docker Engine-Communityの特定のバージョンをインストールするには、リポジトリに利用可能なバージョンをリストして、インストールを選択してください。ウェアハウスで利用可能なバージョンを一覧表示します。

apt-cache madison docker-ce

docker-ce | 5:18.09.1~3-0~ubuntu-xenial | https://mirrors.ustc.edu.cn/docker-ce/linux	/ubuntu  xenial/stable amd64 Packages
docker-ce | 5:18.09.0~3-0~ubuntu-xenial | https://mirrors.ustc.edu.cn/docker-ce/linux/	ubuntu  xenial/stable amd64 Packages
docker-ce | 18.06.1~ce~3-0~ubuntu       | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu  xenial/stable amd64 Packages
docker-ce | 18.06.0~ce~3-0~ubuntu       | https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu  xenial/stable amd64 Packages
 ...

2番目のタイプのバージョン文字列を使用して、5:18.09.1〜3-0ubuntu-xenialなどの特定のバージョンをインストールします。

sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

Dockerが正常にインストールされたかどうかをテストするには、次のコマンドを入力し、次の情報を出力して正常にインストールします。

sudo docker run hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete                                                                                                                                  Digest: 	sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
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://hub.docker.com/


For more examples and ideas, visit:
https://docs.docker.com/get-started/

おすすめ

転載: blog.csdn.net/m0_45388819/article/details/109453497