full_container_scheme/1.docs/1.1 docker.md

74 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!--
* @Author: admin@attacker.club
* @Date: 2022-09-14 21:38:54
* @LastEditTime: 2023-02-16 10:13:18
* @Description:
-->
# docker 部署
部署
- 在线 shell 安装
```bash
curl -sSL https://get.docker.com/ | sh
```
- yum
```bash
## 清理老的版本
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
## yum在线安装
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
# 添加Docker软件包源
sudo yum install docker-ce docker-ce-cli containerd.io
# 安装Docker CE
systemctl start docker && systemctl enable docker
# 启动服务
```
## docker 配置
```bash
cat > /etc/docker/daemon.json << EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"graph": "/var/lib",
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"registry-mirrors": [
"https://1lcdq5an.mirror.aliyuncs.com",
"https://mirror.ccs.tencentyun.com",
"http://hub-mirror.c.163.com"
]
}
EOF
# log日志保存大小设置为100M
# "graph": "/data/docker"指定docker默认数据路径
# "exec-opts": ["native.cgroupdriver=systemd"],
## 调整docker Cgroup Driver为systemd和日志格式设定
systemctl restart docker # 重启docker
```