现象
当安装好docker-compose
之后,在命令行执行docker-compose up
,会出现如下报错:
- 1Traceback (most recent call last):
- 2File "urllib3/connectionpool.py", line 677, in urlopen
- 3File "urllib3/connectionpool.py", line 392, in _make_request
- 4File "http/client.py", line 1252, in request
- 5File "http/client.py", line 1298, in _send_request
- 6File "http/client.py", line 1247, in endheaders
- 7File "http/client.py", line 1026, in _send_output
- 8File "http/client.py", line 966, in send
- 9File "docker/transport/unixconn.py", line 43, in connect
- 10FileNotFoundError: [Errno 2] No such file or directory
- 11
- 12During handling of the above exception, another exception occurred:
- 13
- 14Traceback (most recent call last):
- 15File "requests/adapters.py", line 449, in send
- 16File "urllib3/connectionpool.py", line 727, in urlopen
- 17File "urllib3/util/retry.py", line 403, in increment
- 18File "urllib3/packages/six.py", line 734, in reraise
- 19File "urllib3/connectionpool.py", line 677, in urlopen
- 20File "urllib3/connectionpool.py", line 392, in _make_request
- 21File "http/client.py", line 1252, in request
- 22File "http/client.py", line 1298, in _send_request
- 23File "http/client.py", line 1247, in endheaders
- 24File "http/client.py", line 1026, in _send_output
- 25File "http/client.py", line 966, in send
- 26File "docker/transport/unixconn.py", line 43, in connect
- 27urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
- 28
- 29During handling of the above exception, another exception occurred:
- 30
- 31Traceback (most recent call last):
- 32File "docker/api/client.py", line 205, in _retrieve_server_version
- 33File "docker/api/daemon.py", line 181, in version
- 34File "docker/utils/decorators.py", line 46, in inner
- 35File "docker/api/client.py", line 228, in _get
- 36File "requests/sessions.py", line 543, in get
- 37File "requests/sessions.py", line 530, in request
- 38File "requests/sessions.py", line 643, in send
- 39File "requests/adapters.py", line 498, in send
- 40requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
- 41
- 42During handling of the above exception, another exception occurred:
- 43
- 44Traceback (most recent call last):
- 45File "bin/docker-compose", line 3, in
- 46File "compose/cli/main.py", line 67, in main
- 47File "compose/cli/main.py", line 123, in perform_command
- 48File "compose/cli/command.py", line 69, in project_from_options
- 49File "compose/cli/command.py", line 132, in get_project
- 50File "compose/cli/docker_client.py", line 43, in get_client
- 51File "compose/cli/docker_client.py", line 170, in docker_client
- 52File "docker/api/client.py", line 188, in init
- 53File "docker/api/client.py", line 213, in _retrieve_server_version
- 54docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
解决方案
一般而言,主要有三个原因导致,可以依次排查
-
如果当前用户没有系统管理员的权限,就需要加
sudo
,即sudo docker-compose up
-
是否安装了
docker
。也就是说,要先安装docker
,再安装docker-compose
-
内存太小,比如只有
1G
内存
评论: