简于形,大于界

Docker

这份快速指南将引导你如何使用Docker。

清理

yum
1yum remove docker-client \
2docker-client-latest \
3docker-common \
4docker-latest \
5docker-latest-logrotate \
6docker-logrotate \
7docker-selinux \
8docker-engine-selinux \
9docker-engine

安装

安装
1yum install yum-utils
2yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3yum install -y docker-ce

设置

daemon.json
1cat > /etc/docker/daemon.json <<EOF
2{
3   "exec-opts": ["native.cgroupdriver=systemd"],
4   "log-driver": "json-file",
5  "log-opts": {
6    "max-size": "100m"
7   },
8  "storage-driver": "overlay2",
9   "registry-mirrors": [
10         "https://hub-mirror.c.163.com",
11       "https://mirror.baidubce.com"
12     ],
13   "insecure-registries": ["registry.fewbox.lan:5000"]
14}
15EOF

检查

docker
1docker --version
2systemctl daemon-reload
3systemctl enable docker
4systemctl start docker
5# 清理所有镜像 docker rmi -f $(docker images -q)