def getConnection(self): """ Get an `HTTPConnection <https://docs.python.org/2/library/httplib.html#httplib.HTTPConnection>`_ to the Docker daemon. Note: You can find more info in the `Docker API docs <https://docs.docker.com/reference/api/docker_remote_api_v1.13/>`_ """ if not self.__connection: subuserlib.docker.getAndVerifyExecutable() self.__connection = UHTTPConnection("/var/run/docker.sock") return self.__connection
def getConnection(self): """ Get an `HTTPConnection <https://docs.python.org/2/library/httplib.html#httplib.HTTPConnection>`_ to the Docker daemon. Note: You can find more info in the `Docker API docs <https://docs.docker.com/reference/api/docker_remote_api_v1.13/>`_ """ if not self.__connection: subuserlib.docker.getAndVerifyExecutable() try: self.__connection = UHTTPConnection("/var/run/docker.sock") except PermissionError as e: sys.exit("Permission error (%s) connecting to the docker socket. This usually happens when you've added yourself as a member of the docker group but haven't logged out/in again before starting subuser."% str(e)) return self.__connection