K 8 S配備手順:3-dockerのインストールとアンインストール
5038 ワード
kubernetesシステムで使用されている多くのコンポーネントのdockerミラーはgoogleから来ています.これは、kubernetesの公式サイトが完璧な配置ドキュメントを提供しているのに、配置が難しい理由です(原因は分かります).この章では、dockerとそのプライベートウェアハウスharborのインストール、harborストレージで使用されるミラーの使用について説明します.
Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.
Use the following command to set up the stable repository. You always need the stable repository, even if you want to install builds from the edge or test repositories as well.
タイムアウトしたら、
Optional: Enable the edge and test repositories. These repositories are included in the docker.repo file above but are disabled by default. You can enable them alongside the stable repository.
Install the latest version of Docker CE, or go to the next step to install a specific version.
注意:docker-ceをインストールするときにpigzと別のものが少なくなったと間違えました.pigzは圧縮ツールで、redhatのデフォルトソースにはありませんので、手動でダウンロードします.
redhatのextraウェアハウスも有効にします
Start Docker.
Verify that docker is installed correctly by running the hello-world image.
Uninstall the Docker package:
Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:
pullイメージの速度を速めるために、国内の倉庫ミラーサーバを使用し、ダウンロードの同時数を増やすことができます.dockerdがすでに実行されている場合は、dockerdを再起動して有効にする必要があります.
dockerは1.13から、iptables FOrWARD chainのデフォルトポリシーをDROPに設定し、pingの他のノードのPod IPに失敗する可能性があります.この場合、手動でポリシーをACCEPTに設定する必要があります.
以下のコマンドを/etc/rcに書き込む.localファイルでは、ノードがiptables FOrWARD chainを再起動しないようにするデフォルトポリシーがDROPに復元されます.
docker ceのインストール
Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
Use the following command to set up the stable repository. You always need the stable repository, even if you want to install builds from the edge or test repositories as well.
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
タイムアウトしたら、
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Optional: Enable the edge and test repositories. These repositories are included in the docker.repo file above but are disabled by default. You can enable them alongside the stable repository.
$ sudo yum-config-manager --enable docker-ce-edge
$ sudo yum-config-manager --enable docker-ce-test
Install the latest version of Docker CE, or go to the next step to install a specific version.
$ sudo yum install docker-ce
注意:docker-ceをインストールするときにpigzと別のものが少なくなったと間違えました.pigzは圧縮ツールで、redhatのデフォルトソースにはありませんので、手動でダウンロードします.
udo yum install -y https://mirrors.aliyun.com/centos/7/extras/x86_64/Packages/pigz-2.3.3-1.el7.centos.x86_64.rpm
redhatのextraウェアハウスも有効にします
Start Docker.
$ sudo systemctl enable docker
$ sudo systemctl start docker
Verify that docker is installed correctly by running the hello-world image.
$ sudo docker run hello-world
Uninstall Docker CE
Uninstall the Docker package:
$ sudo yum remove docker-ce
Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:
$ sudo rm -rf /var/lib/docker
ミラー加速
pullイメージの速度を速めるために、国内の倉庫ミラーサーバを使用し、ダウンロードの同時数を増やすことができます.dockerdがすでに実行されている場合は、dockerdを再起動して有効にする必要があります.
$ cat > /etc/docker/daemon.json << EOF
{
"registry-mirrors": ["https://sojq08wg.mirror.aliyuncs.com", "https://docker.mirrors.ustc.edu.cn"],
"max-concurrent-downloads": 10
}
EOF
dockerは1.13から、iptables FOrWARD chainのデフォルトポリシーをDROPに設定し、pingの他のノードのPod IPに失敗する可能性があります.この場合、手動でポリシーをACCEPTに設定する必要があります.
$ sudo iptables -P FORWARD ACCEPT
以下のコマンドを/etc/rcに書き込む.localファイルでは、ノードがiptables FOrWARD chainを再起動しないようにするデフォルトポリシーがDROPに復元されます.
sleep 60 && /sbin/iptables -P FORWARD ACCEPT