Docker拉取镜像超时
报错
Unable to find image 'dpanel/dpanel:latest' locally
docker: Error response from daemon: Get "https://registry-1.docker.io/v2/  ": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
 
解决方式
在etc/docker/目录下创建daemon.json文件,将下面内容粘贴进去。
{"registry-mirrors": ["https://registry.cn-hangzhou.aliyuncs.com","https://do.nark.eu.org","https://dc.j8.work","https://docker.m.daocloud.io","https://dockerproxy.com","https://docker.mirrors.ustc.edu.cn","https://docker.nju.edu.cn"]
}
 
docker重新加载文件,然后重启;
sudo systemctl daemon-reload
sudo systemctl restart docker
 
命令方式操作
sudo tee /etc/docker/daemon.json <<-'EOF'
{"registry-mirrors": ["https://registry.cn-hangzhou.aliyuncs.com","https://do.nark.eu.org","https://dc.j8.work","https://docker.m.daocloud.io","https://dockerproxy.com","https://docker.mirrors.ustc.edu.cn","https://docker.nju.edu.cn"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker 
镜像被多个仓库引用
报错
Error response from daemon: conflict: unable to delete c2a6a40506b9 (must be forced) - image is referenced in multiple repositories
 
解决方式
- 查看镜像引用
 
docker images
 
- 删除镜像引用
 
docker rmi <镜像名称>:<标签>
 
- 强制删除镜像
如果镜像仍然无法删除,可以使用 -f 或 --force 选项强制删除: 
docker rmi -f  <镜像名称/id>
 
Docker未正确登录到镜像仓库,或权限不足
报错:
docker push crpi-5qc4odiityxeoecl.cn-hangzhou.personal.cr.aliyuncs.com/aliyun-namespace-lym/dpanel/dpanel:latest
The push refers to repository [crpi-5qc4odiityxeoecl.cn-hangzhou.personal.cr.aliyuncs.com/aliyun-namespace-lym/dpanel/dpanel]
5f70bf18a086: Preparing 
663fbf8d6b31: Preparing 
37ae894d7828: Preparing 
618509a5037e: Preparing 
645a17712757: Preparing 
e48cf4869d45: Waiting 
a49ad3c60d1c: Waiting 
3ac371982ee8: Waiting 
08000c18d16d: Waiting 
denied: requested access to the resource is denied
 
解决方式
- 登录到目标镜像仓库
 
docker login xxx.xxx.xxx.cr.aliyuncs.com
 
- 重新配置镜像仓库
如果问题仍然存在,可以尝试重新配置镜像仓库
2.1. 删除镜像仓库。
2.2. 重新创建镜像仓库。
2.3. 重新推送镜像 
docker-compose.yml文件配置错误
 
报错
compose up 
yaml: unmarshal errors:line 109: mapping key "networks" already defined at line 107
 
解决
确保 networks 部分只定义一次。如果需要定义多个网络,应该将它们放在同一个 networks 部分下。例如:
networks:my_network:driver: bridgeanother_network:driver: bridge
 
未在 docker-compose.yml文件所在目录启动
 
报错
docker compose up 
no configuration file provided: not found
 
解决
指定配置文件路径
docker compose -f /path/to/docker-compose.yml up