worstcase / blockade

Docker-based utility for testing network failures and partitions in distributed applications
http://blockade.readthedocs.org
Apache License 2.0
907 stars 72 forks source link

Not using $DOCKER_HOST I think #1

Closed drnic closed 7 years ago

drnic commented 10 years ago

I'm trying blockade on OS/X where docker -d is running inside a vagrant VM (via https://github.com/noplay/docker-osx).

I have $DOCKER_HOST set, so normal docker commands work nicely.

When I run blockade up I get an error that looks like its only trying to connect via local sockets.

$ blockade up     

Unexpected error! This may be a Blockade bug.

Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/blockade/cli.py", line 242, in main
    opts.func(opts)
  File "/Library/Python/2.7/site-packages/blockade/cli.py", line 109, in cmd_up
    containers = b.create()
  File "/Library/Python/2.7/site-packages/blockade/core.py", line 47, in create
    veth_device)
  File "/Library/Python/2.7/site-packages/blockade/core.py", line 60, in _start_container
    environment=container.environment)
  File "/Library/Python/2.7/site-packages/docker/client.py", line 347, in create_container
    return self.create_container_from_config(config, name)
  File "/Library/Python/2.7/site-packages/docker/client.py", line 354, in create_container_from_config
    res = self._post_json(u, data=config, params=params)
  File "/Library/Python/2.7/site-packages/docker/client.py", line 199, in _post_json
    return self._post(url, data=json.dumps(data2), **kwargs)
  File "/Library/Python/2.7/site-packages/docker/client.py", line 89, in _post
    return self.post(url, **self._set_request_timeout(kwargs))
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 377, in post
    return self.request('POST', url, data=data, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 335, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 438, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/adapters.py", line 327, in send
    raise ConnectionError(e)
ConnectionError: UnixHTTPConnectionPool(host='localhost', port=None): Max retries exceeded with url: /run/docker.sock/v1.6/containers/create?name=blockade-eaf8721d19-c1 (Caused by <class 'socket.error'>: [Errno 2] No such file or directory)
turtlebender commented 10 years ago

The next release of blockade should provide support for dvm. I'll look at supporting the docker-osx project as well

drnic commented 10 years ago

Lovely, thx.

On Fri, Feb 14, 2014 at 6:56 AM, Tom Howe notifications@github.com wrote:

The next release of blockade should provide support for dvm. I'll look at supporting the docker-osx project as well

Reply to this email directly or view it on GitHub: https://github.com/dcm-oss/blockade/issues/1#issuecomment-35090179

logikal commented 10 years ago

+1 to this. Even when not using dvm, boot2docker or similar, blockade assumes that you are running docker with a local unix socket. If you're running docker with tcp only, blockade isn't able to connect to docker.

labisso commented 7 years ago

Nearly 3 years later, DOCKER_HOST is finally fully respected by Blockade and we can close this ticket.

Until recently, it didn't matter too much since Blockade was required to be executed on the docker host as root, in order to run the tc/iptables commands. And our initial plans to do this via fabric/paramiko got messy and abandoned. But in 0.3.0, we moved these commands into containers of their own, with host networking. And in 0.3.1 (just now released), a lingering bug was fixed that prevented DOCKER_HOST from being consulted in one place.