docker 安装

docker 安装

# 在 docker 节点执行

# 腾讯云 docker hub 镜像

# export REGISTRY_MIRROR="https://mirror.ccs.tencentyun.com"

# DaoCloud 镜像

# export REGISTRY_MIRROR="http://f1361db2.m.daocloud.io"

# 阿里云 docker hub 镜像

export REGISTRY_MIRROR=https://registry.cn-hangzhou.aliyuncs.com

 

# 安装 docker

# 参考文档如下

# https://docs.docker.com/install/linux/docker-ce/centos/ 

# https://docs.docker.com/install/linux/linux-postinstall/

 

# 卸载旧版本

yum remove -y docker \

docker-client \

docker-client-latest \

docker-ce-cli \

docker-common \

docker-latest \

docker-latest-logrotate \

docker-logrotate \

docker-selinux \

docker-engine-selinux \

docker-engine

 

# 设置 yum repository

yum install -y yum-utils \

device-mapper-persistent-data \

lvm2

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

 

# 安装并启动 docker

yum install -y docker-ce-19.03.11 docker-ce-cli-19.03.11 containerd.io-1.2.13

 

mkdir /etc/docker || true

 

cat > /etc/docker/daemon.json <<EOF

{

  "registry-mirrors": ["${REGISTRY_MIRROR}"],

  "exec-opts": ["native.cgroupdriver=systemd"],

  "log-driver": "json-file",

  "log-opts": {

    "max-size": "100m"

  },

  "storage-driver": "overlay2",

  "storage-opts": [

    "overlay2.override_kernel_check=true"

  ]

}

EOF

 

mkdir -/etc/systemd/system/docker.service.d

 

Restart Docker

systemctl daemon-reload

systemctl enable docker

systemctl restart docker

 

# 关闭 防火墙

systemctl stop firewalld

systemctl disable firewalld

 

# 关闭 SeLinux

setenforce 0

sed -"s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

 

# 关闭 swap

swapoff -a

yes | cp /etc/fstab /etc/fstab_bak

cat /etc/fstab_bak |grep -v swap > /etc/fstab

 

# 验证

 

[root@vm-1]# docker info

Client:

 Debug Mode: false

 

Server:

 Containers: 16

  Running: 11

  Paused: 0

  Stopped: 5

 Images: 22

 Server Version: 19.03.11

 Storage Driver: overlay2

  Backing Filesystem: xfs

  Supports d_type: true

  Native Overlay Diff: true

 Logging Driver: json-file

 Cgroup Driver: systemd

 Plugins:

  Volume: local

  Network: bridge host ipvlan macvlan null overlay

  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog

 Swarm: inactive

 Runtimes: runc

 Default Runtime: runc

 Init Binary: docker-init

 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429

 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd

 init version: fec3683

 Security Options:

  seccomp

   Profile: default

 Kernel Version: 3.10.0-1127.el7.x86_64

 Operating System: CentOS Linux 7 (Core)

 OSType: linux

 Architecture: x86_64

 CPUs: 4

 Total Memory: 11.58GiB

 Name: vm-autotest-server

 ID: KQ5B:KAG5:LLB5:CUD4:NQZX:4GHL:5XLY:FM7X:KRJ5:X3WK:42GV:QLON

 Docker Root Dir: /var/lib/docker

 Debug Mode: false

 Registry: https://index.docker.io/v1/

 Labels:

 Experimental: false

 Insecure Registries:

  172.16.62.179:5000

  127.0.0.0/8

 Registry Mirrors:

  https://registry.cn-hangzhou.aliyuncs.com/

 Live Restore Enabled: false

 

 

posted @ 2022-01-17 10:26  Allen-非一非零  阅读(41)  评论(0编辑  收藏  举报