Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Docker in Docker for bugzoo iteractions #5

#1

I have a docker container that runs Bugzoo and I'm getting what seem to be socket issues - see below.
If I need to run bugzoo in another docker container, is there something I'm missing in my docker set up to enable this?
I'm running the encapsulating docker container with --privileged
The following trace happens after my script runs bugzoo source add <mysrc> <mysrc_path> in the docker container.

DEBUG:bugzoo.manager:2019-08-20 21:01:43,408: using default Docker Client API
ERROR:bugzoo.cli.app:2019-08-20 21:01:43,410: An unexpected error occurred
Traceback (most recent call last):
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 355, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/docker/transport/unixconn.py", line 43, in connect
    sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 641, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/urllib3/util/retry.py", line 368, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/urllib3/packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 355, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/docker/transport/unixconn.py", line 43, in connect
    sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/bugzoo/cli/app.py", line 75, in main
    with BugZooCLI() as app:
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/cement/core/foundation.py", line 1677, in __enter__
    self.setup()
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/bugzoo/cli/app.py", line 45, in setup
    self.daemon = Daemon()
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/bugzoo/manager.py", line 74, in __init__
    assert self.__docker.ping()
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/docker/client.py", line 187, in ping
    return self.api.ping(*args, **kwargs)
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/docker/api/daemon.py", line 166, in ping
    return self._result(self._get(self._url('/_ping'))) == 'OK'
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/docker/api/client.py", line 230, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/ProgramRepair/pr_venv/lib/python3.6/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
  • replies 2
  • views 3.9K
  • likes 1
#2

It looks like you've run into the problem of trying to interact with Docker whilst inside a Docker container. There are two common solutions to the problem. One solution is overkill and should be avoided at all costs (dind: Docker-in-Docker). The other, saner, solution is to mount the Docker socket (whose absence is causing the exception that you're seeing) into the BugZoo container via volume mounting:

$ docker run -v /var/run/docker.sock:/var/run/docker.sock --rm -it bugzoo

(Note: there are a couple of places where BugZoo interacts with Docker via the CLI rather than its HTTP interface. To avoid any issues, you'll probably want to install Docker inside the BugZoo container -- don't worry, that's not a Docker-in-Docker solution :slight_smile:.)

#3