部署容器运行时

容器运行时可以选择Docker、CRI-O、Containerd等,这里选择大家比较熟悉的docker

Ubuntu(使用apt 安装)

## 安装环境准备。
apt-get update && apt-get install apt-transport-https ca-certificates curl software-properties-common

## 下载 GPG 密钥。
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -

## 添加 docker apt 镜像仓库。
add-apt-repository \
   "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

## 安装 docker。
apt-get update && apt-get install docker-ce

# 配置守护进程。
cat > /etc/docker/daemon.json <<EOF
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}
EOF

# 重启 docker。
systemctl enable docker
systemctl restart docker

CentOS 7 (使用yum进行安装)

## 安装环境准备。
yum install yum-utils device-mapper-persistent-data lvm2

## 添加 docker 镜像仓库。
yum-config-manager \
  --add-repo \
  https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

## 安装 docker。
yum update && yum install docker-ce

## 创建 /etc/docker 目录。
mkdir /etc/docker

# 配置守护进程。
cat > /etc/docker/daemon.json <<EOF
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2",
  "storage-opts": [
    "overlay2.override_kernel_check=true"
  ]
}
EOF

# 重启 docker。
systemctl enable docker
systemctl restart docker

安装校验

root@ubuntu:~ # docker version
Client:
 Version:           18.09.7
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        2d0083d
 Built:             Thu Jun 27 17:56:23 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.7
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       2d0083d
  Built:            Thu Jun 27 17:23:02 2019
  OS/Arch:          linux/amd64
  Experimental:     false

results matching ""

    No results matching ""