前提条件
1、使用docker-compose之前,一定要安装并且运行Docker
2、拉取镜像之前,一定要配置Docker镜像加速,否则下载特别慢
情况1 docker-compose无法打开
错误信息:
cannot open self /usr/local/bin/docker-compose or archive
有可能是docker-compose文件问题。
解决办法
如果无法从github下载docker-compose,进度一直卡在0%,可以直接从百度网盘下载docker-compose文件以后传输到 /usr/local/bin目录(使用xshell)
链接:https://pan.baidu.com/s/1C9WQKVkmPbwc2g2n2TBCBg?pwd=8888
docker-compose下载以后是没有可执行权限的,执行:chmod +x docker-compose
情况2 Permission denied 没有权限
docker-compose下载以后是没有可执行权限的,执行:chmod +x docker-compose
情况3 Docker未启动
错误信息:
docker: ERROR: Couldn‘t connect to Docker daemon
at http+docker://localhost
其他错误信息:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose/cli/main.py", line 81, in main
File "compose/cli/main.py", line 200, in perform_command
File "compose/cli/command.py", line 70, in project_from_options
File "compose/cli/command.py", line 153, in get_project
File "compose/cli/docker_client.py", line 43, in get_client
File "compose/cli/docker_client.py", line 170, in docker_client
File "docker/api/client.py", line 197, in __init__
File "docker/api/client.py", line 222, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
[2701] Failed to execute script docker-compose
解决办法
Docker未启动的问题,运行以下命令:systemctl start docker
可参考:
https://blog.csdn.net/a1368783069/article/details/132231533
情况4 防火墙问题
错误信息:
ERROR: Failed to Setup IP tables:
Unable to enable SKIP DNAT rule: (iptables failed: iptables
原因分析:
原因是关闭防火墙之后Docker需要重启
解决办法
重启docker服务service docker restart
情况5 域名解析问题
错误信息:
Get "https://registry.cn-shenzhen.aliyuncs.com/v2/":
dial tcp: lookup registry.cn-shenzhen.aliyuncs.com
on 192.168.100.1:53: read udp 192.168.100.5:47710-
>192.168.100.1:53: read: connection refused
解决方法
命令方式vi /etc/resolv.conf
添加这两行
nameserver 8.8.8.8
nameserver 8.8.4.4
其他情况
可以用 docker-compose down
删除靶场,docker-compose up
重新下载运行