---
title: Docker配置指导
description: "1. 创建daemon.json文件配置Docker。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdevps/portingadvisor/systemmigration/DevKit_Porting_0072.html
sourcePath: /source/zh/kunpengdevps/portingadvisor/systemmigration/DevKit_Porting_0072.html
indexId: 09d455d0dadee369a9aeb99273c4dbf8ae3a636864662bd096c3b5dc27181f3579
---
# Docker配置指导

1. 创建daemon.json文件配置Docker。
  1 2 sudo mkdir -p /etc/docker sudo vim /etc/docker/daemon.json

  daemon.json配置如下：

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 { "registry-mirrors": [ "https://dockerhub.azk8s.cn", "https://docker.mirrors.ustc.edu.cn", "http://hub-mirror.c.163.com", "https://k8s.gcr.io", "https://github-releases.githubusercontent.com", "https://ustc-edu-cn.mirror.aliyuncs.com" ], "insecure-registries": [ "registry.me:5000", "http://docker.mirrors.ustc.edu.cn", "https://k8s.gcr.io", "https://github-releases.githubusercontent.com", "https://registry-1.docker.io" ], "exec-opts": [ "native.cgroupdriver=systemd" ] }

2. 创建http-proxy.conf文件配置代理。若已配置代理，可跳过此步骤。
  1 2 sudo mkdir -p /etc/systemd/system/docker.service.d sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf

  http-proxy.conf配置模板如下（谨慎配置，确保代理设置正确）：

  1 2 3 4 [Service] Environment="HTTP_PROXY=http://proxy.example.com:8080" Environment="HTTPS_PROXY=http://proxy.example.com:8080" Environment="NO_PROXY=localhost,127.0.0.1,docker-registry.example.com"

  proxy.example.com：替换为实际代理服务器地址。 NO_PROXY：配置不需要代理的地址。

3. 重启Docker服务。
  1 2 sudo systemctl daemon-reload sudo systemctl restart docker
