seaworthy icon indicating copy to clipboard operation
seaworthy copied to clipboard

incompatible with DOCKER_HOST using ssh protocol

Open ssbarnea opened this issue 5 years ago • 0 comments

Last year docker enabled use of ssh transport protocol for talking with docker, effectively enabling safe remoting. The python docker library works perfectly with that and its users do not need to be updated but somehow seaworthy seems to choke when dockerhost is using ssh.

You should be able to reasily reproduce the issue by defining DOCKER_HOST=ssh://root@localhost or something similar.

test/test_install.py:54:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/seaworthy/definitions.py:265: in setup
    self.run(**run_kwargs)
../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/seaworthy/definitions.py:318: in run
    self.create(fetch_image=fetch_image, **kwargs)
../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/seaworthy/definitions.py:67: in create
    self.name, *self._create_args, **kwargs)
../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/seaworthy/helpers.py:194: in create
    network = self._network_for_container(network, kwargs)
../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/seaworthy/helpers.py:227: in _network_for_container
    return self._network_helper.get_default()
../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/seaworthy/helpers.py:336: in get_default
    self._default_network = self.create('default', driver='bridge')
../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/seaworthy/helpers.py:356: in create
    return super().create(name, check_duplicate=check_duplicate, **kwargs)
../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/seaworthy/helpers.py:109: in create
    resource = self.collection.create(*args, name=resource_name, **kwargs)
../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/docker/models/networks.py:154: in create
    resp = self.client.api.create_network(name, *args, **kwargs)
../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/docker/api/network.py:152: in create_network
    return self._result(res, json=True)
../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/docker/api/client.py:262: in _result
    self._raise_for_status(response)
../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/docker/api/client.py:258: in _raise_for_status
    raise create_api_error_from_http_exception(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

e = HTTPError('409 Client Error: Conflict for url: http+docker://ssh/v1.35/networks/create',)

    def create_api_error_from_http_exception(e):
        """
        Create a suitable APIError from requests.exceptions.HTTPError.
        """
        response = e.response
        try:
            explanation = response.json()['message']
        except ValueError:
            explanation = (response.content or '').strip()
        cls = APIError
        if response.status_code == 404:
            if explanation and ('No such image' in str(explanation) or
                                'not found: does not exist or no pull access'
                                in str(explanation) or
                                'repository does not exist' in str(explanation)):
                cls = ImageNotFound
            else:
                cls = NotFound
>       raise cls(e, response=response, explanation=explanation)
E       docker.errors.APIError: 409 Client Error: Conflict ("network with name test_default already exists")

../../.pyenv/versions/3.6.7/lib/python3.6/site-packages/docker/errors.py:31: APIError

ssbarnea avatar Apr 13 '19 19:04 ssbarnea