docker-compose up 在 Ubuntu 20.04.2 LTS 上不起作用

docker-compose up 在 Ubuntu 20.04.2 LTS 上不起作用

docker-compose --verbose up -d在一个包含文件的项目中运行了docker-compose.yml它。我得到了以下输出:

compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.utils.config.find_config_file: Trying paths: ['/home/ubuntu/snap/docker/796/.docker/config.json', '/home/ubuntu/snap/docker/796/.dockercfg']
docker.utils.config.find_config_file: No config file found
docker.utils.config.find_config_file: Trying paths: ['/home/ubuntu/snap/docker/796/.docker/config.json', '/home/ubuntu/snap/docker/796/.dockercfg']
docker.utils.config.find_config_file: No config file found
Traceback (most recent call last):
  File "/snap/docker/796/lib/python3.6/site-packages/urllib3/connectionpool.py", line 706, in urlopen
    chunked=chunked,
  File "/snap/docker/796/lib/python3.6/site-packages/urllib3/connectionpool.py", line 394, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/snap/docker/796/usr/lib/python3.6/http/client.py", line 1281, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/snap/docker/796/usr/lib/python3.6/http/client.py", line 1327, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/snap/docker/796/usr/lib/python3.6/http/client.py", line 1276, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/snap/docker/796/usr/lib/python3.6/http/client.py", line 1042, in _send_output
    self.send(msg)
  File "/snap/docker/796/usr/lib/python3.6/http/client.py", line 980, in send
    self.connect()
  File "/snap/docker/796/lib/python3.6/site-packages/docker/transport/unixconn.py", line 43, in connect
    sock.connect(self.unix_socket)
PermissionError: [Errno 13] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/snap/docker/796/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/snap/docker/796/lib/python3.6/site-packages/urllib3/connectionpool.py", line 756, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/snap/docker/796/lib/python3.6/site-packages/urllib3/util/retry.py", line 531, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/snap/docker/796/lib/python3.6/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/snap/docker/796/lib/python3.6/site-packages/urllib3/connectionpool.py", line 706, in urlopen
    chunked=chunked,
  File "/snap/docker/796/lib/python3.6/site-packages/urllib3/connectionpool.py", line 394, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/snap/docker/796/usr/lib/python3.6/http/client.py", line 1281, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/snap/docker/796/usr/lib/python3.6/http/client.py", line 1327, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/snap/docker/796/usr/lib/python3.6/http/client.py", line 1276, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/snap/docker/796/usr/lib/python3.6/http/client.py", line 1042, in _send_output
    self.send(msg)
  File "/snap/docker/796/usr/lib/python3.6/http/client.py", line 980, in send
    self.connect()
  File "/snap/docker/796/lib/python3.6/site-packages/docker/transport/unixconn.py", line 43, in connect
    sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/snap/docker/796/bin/docker-compose", line 33, in <module>
    sys.exit(load_entry_point('docker-compose==1.25.5', 'console_scripts', 'docker-compose')())
  File "/snap/docker/796/lib/python3.6/site-packages/compose/cli/main.py", line 72, in main
    command()
  File "/snap/docker/796/lib/python3.6/site-packages/compose/cli/main.py", line 125, in perform_command
    project = project_from_options('.', options)
  File "/snap/docker/796/lib/python3.6/site-packages/compose/cli/command.py", line 65, in project_from_options
    environment_file=environment_file
  File "/snap/docker/796/lib/python3.6/site-packages/compose/cli/command.py", line 149, in get_project
    host=host, environment=environment
  File "/snap/docker/796/lib/python3.6/site-packages/compose/cli/command.py", line 123, in get_client
    version_info = six.iteritems(client.version())
  File "/snap/docker/796/lib/python3.6/site-packages/docker/api/daemon.py", line 181, in version
    return self._result(self._get(url), json=True)
  File "/snap/docker/796/lib/python3.6/site-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
  File "/snap/docker/796/lib/python3.6/site-packages/docker/api/client.py", line 237, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/snap/docker/796/lib/python3.6/site-packages/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/snap/docker/796/lib/python3.6/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/snap/docker/796/lib/python3.6/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/snap/docker/796/lib/python3.6/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', PermissionError(13, 'Permission denied'))
ubuntu@staging02:~/repo/SitesWeb$ 

答案1

可能是权限问题。如果尚未完成,请将您的帐户添加到 docker 组或使用sudo。即sudo docker-compose --verbose up -d

相关内容