From 8c787cfa88bef3e7b0b5f88dfa37979087a0a565 Mon Sep 17 00:00:00 2001 From: shonenada Date: Thu, 23 Jul 2020 11:40:50 +0800 Subject: [PATCH] fix code format of zh/docs/setup/production-environment/container-runtimes --- .../container-runtimes.md | 256 ++++++++++++++++-- 1 file changed, 234 insertions(+), 22 deletions(-) diff --git a/content/zh/docs/setup/production-environment/container-runtimes.md b/content/zh/docs/setup/production-environment/container-runtimes.md index fb3dde5428..2873951241 100644 --- a/content/zh/docs/setup/production-environment/container-runtimes.md +++ b/content/zh/docs/setup/production-environment/container-runtimes.md @@ -41,7 +41,7 @@ Please refer to this link for more information about this issue 我们发现 runc 在运行容器,处理系统文件描述符时存在一个漏洞。 恶意容器可以利用此漏洞覆盖 runc 二进制文件的内容,并以此在主机系统的容器上运行任意的命令。 -请参考此链接以获取有关此问题的更多信息 [cve-2019-5736 : runc vulnerability ] (https://access.redhat.com/security/cve/cve-2019-5736) +请参考此链接以获取有关此问题的更多信息 [cve-2019-5736 : runc vulnerability ](https://access.redhat.com/security/cve/cve-2019-5736) {{< /caution >}} + +```shell # 安装 Docker CE ## 设置仓库 ### 安装软件包以允许 apt 通过 HTTPS 使用存储库 apt-get update && apt-get install \ apt-transport-https ca-certificates curl software-properties-common +``` +```shell ### 新增 Docker 的 官方 GPG 秘钥 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - - +``` +```shell ### 添加 Docker apt 仓库 add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" +``` +```shell ## 安装 Docker CE -apt-get update && apt-get install docker-ce=18.06.2~ce~3-0~ubuntu +apt-get update && apt-get install -y\ + containerd.io=1.2.13-2 \ + docker-ce=5:19.03.11~3-0~ubuntu-$(lsb_release -cs) \ + docker-ce-cli=5:19.03.11~3-0~ubuntu-$(lsb_release -cs) +``` +```shell # 设置 daemon cat > /etc/docker/daemon.json < /etc/docker/daemon.json < +```shell # 重启 docker. systemctl daemon-reload systemctl restart docker -{{< /tab >}} -{{< tab name="CentOS/RHEL 7.4+" codelang="bash" >}} +``` +{{% /tab %}} +{{% tab name="CentOS/RHEL 7.4+" %}} +```shell # 安装 Docker CE ## 设置仓库 ### 安装所需包 yum install yum-utils device-mapper-persistent-data lvm2 +``` +```shell ### 新增 Docker 仓库。 yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo +``` +```shell ## 安装 Docker CE. yum update && yum install docker-ce-18.06.2.ce +``` +```shell ## 创建 /etc/docker 目录。 mkdir /etc/docker +``` +```shell # 设置 daemon。 cat > /etc/docker/daemon.json < /etc/docker/daemon.json < +```shell # 重启 Docker systemctl daemon-reload systemctl restart docker -{{< /tab >}} -{{< /tabs >}} +``` +{{% /tab %}} +{{% /tabs %}} + + + +如果你想开机即启动 docker 服务,执行以下命令: + +```shell +sudo systemctl enable docker +``` + 请参阅[官方 Docker 安装指南](https://docs.docker.com/engine/installation/) 来获取更多的信息。 @@ -349,7 +394,113 @@ sysctl --system ``` {{< tabs name="tab-cri-cri-o-installation" >}} -{{< tab name="Ubuntu 16.04" codelang="bash" >}} +{{% tab name="Debian" %}} + + + +```shell +# Debian Unstable/Sid +echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_Unstable/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_Unstable/Release.key -O- | sudo apt-key add - +``` + + + +```shell +# Debian Testing +echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_Testing/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_Testing/Release.key -O- | sudo apt-key add - +``` + + + +```shell +# Debian 10 +echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_10/Release.key -O- | sudo apt-key add - +``` + + + +```shell +# Raspbian 10 +echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Raspbian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Raspbian_10/Release.key -O- | sudo apt-key add - +``` + + + +随后安装 CRI-O: + +```shell +sudo apt-get install cri-o-1.17 +``` + +{{% /tab %}} + +{{% tab name="Ubuntu 18.04, 19.04 and 19.10" %}} + + + +```shell +# 配置仓库 +. /etc/os-release +sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" +wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O- | sudo apt-key add - +sudo apt-get update +``` + + + +```shell +# 安装 CRI-O +sudo apt-get install cri-o-1.17 +``` +{{% /tab %}} + +{{% tab name="Ubuntu 16.04" %}} +```shell # 安装必备软件 apt-get update apt-get install software-properties-common @@ -371,9 +523,9 @@ apt-get update # 安装 CRI-O apt-get install cri-o-1.15 - -{{< /tab >}} -{{< tab name="CentOS/RHEL 7.4+" codelang="bash" >}} +``` +{{% /tab %}} +{{% tab name="CentOS/RHEL 7.4+" codelang="bash" %}} + +```shell # 安装必备软件 yum-config-manager --add-repo=https://cbs.centos.org/repos/paas7-crio-115-release/x86_64/os/ +``` +```shell # 安装 CRI-O yum install --nogpgcheck cri-o +``` + +{{% /tab %}} + +{{% tab name="openSUSE Tumbleweed" %}} + +```shell +sudo zypper install cri-o +``` +{{% /tab %}} -{{< /tab >}} {{< /tabs >}} + +```shell # 安装 containerd ## 设置仓库 ### 安装软件包以允许 apt 通过 HTTPS 使用存储库 apt-get update && apt-get install -y apt-transport-https ca-certificates curl software-properties-common +``` +```shell ### 安装 Docker 的官方 GPG 密钥 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - +``` +```shell ### 新增 Docker apt 仓库。 add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" +``` +```shell ## 安装 containerd apt-get update && apt-get install -y containerd.io +``` +```shell # 配置 containerd mkdir -p /etc/containerd containerd config default > /etc/containerd/config.toml +``` +```shell # 重启 containerd systemctl restart containerd +``` {{< /tab >}} -{{< tab name="CentOS/RHEL 7.4+" codelang="bash" >}} +{{% tab name="CentOS/RHEL 7.4+" %}} + +```shell # 安装 containerd ## 设置仓库 ### 安装所需包 yum install yum-utils device-mapper-persistent-data lvm2 +``` +```shell ### 新增 Docker 仓库 yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo +``` +```shell ## 安装 containerd yum update && yum install containerd.io +``` +```shell # 配置 containerd mkdir -p /etc/containerd containerd config default > /etc/containerd/config.toml - +``` + +```shell # 重启 containerd systemctl restart containerd -{{< /tab >}} +``` +{{% /tab %}} {{< /tabs >}} ### systemd @@ -587,5 +801,3 @@ Refer to the [Frakti QuickStart guide](https://github.com/kubernetes/frakti#quic ## 其他的 CRI 运行时:frakti 请参阅 [Frakti 快速开始指南](https://github.com/kubernetes/frakti#quickstart) 来获取更多的信息。 - -