跳转至

守护进程


更新于 2024-02-14

启动

Bash
1
2
3
4
# 用系统工具命令
sudo systemctl start docker
# 手动启动
dockerd

资源文件路径

  • 默认路径 /var/lib/docker

配置

  • 默认配置文件 /etc/docker/daemon.json

代理

环境变量

  • HTTP_PROXY
  • http_proxy
  • HTTPS_PROXY
  • https_proxy
  • NO_PROXY
  • no_proxy

JSON
1
2
3
4
5
6
7
{
  "proxies": {
    "http-proxy": "http://proxy.example.com:3128",
    "https-proxy": "https://proxy.example.com:3129",
    "no-proxy": "*.test.example.com,.example.org,127.0.0.0/8"
  }
}
Bash
1
2
3
4
5
#重启docker服务
sudo systemctl daemon-reload
sudo systemctl restart docker
#查看
docker info

官网代理文档

点击跳转

备注

只列举了部分用法
详细说明参见官网文档
点此跳转

镜像仓库

Bash
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
sudo touch /etc/docker/daemon.json
#添加下面内容
{
    "registry-mirrors": [
        "https://1nj0zren.mirror.aliyuncs.com",
        "https://docker.mirrors.ustc.edu.cn",
        "http://f1361db2.m.daocloud.io",
        "https://registry.docker-cn.com"
    ]
}

# 重启docker服务
sudo systemctl daemon-reload
sudo systemctl restart docker

# 验证
sudo docker info

资源清理

docker system prune -a