Skip to content

docker 配置

国内镜像

vi /etc/docker/daemon.json
- 新增
{"registry-mirrors": ["https://dockerproxy.cn"]}
- 重载systemd管理守护进程配置文件

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

migrate docker data directory

  • Stop the Docker daemon.
systemctl stop docker
  • Move the existing Docker data directory to the new location.
cp -a /usr/local/docker/. /home/docker/
  • Start the Docker daemon with the --data-root option pointing to the new location.

vi /etc/docker/daemon.json
{
  "data-root": "/home/docker"
}

所有用户使用

groupadd docker usermod -aG docker shingi newgrp docker

☁️ 部署建议
如果你打算长期运行项目(博客 / API / 自动化脚本),建议直接用云服务器,会比本地稳定很多。
👉 查看云服务器(新用户优惠)