mirror of https://github.com/docker/compose.git
Try connecting to localdocker:4243
See https://github.com/noplay/docker-osx/pull/22
This commit is contained in:
parent
0a92cbfa4d
commit
36002f95ed
|
@ -83,21 +83,29 @@ def docker_url():
|
|||
return os.environ['DOCKER_URL']
|
||||
|
||||
socket_path = '/var/run/docker.sock'
|
||||
tcp_hosts = [
|
||||
('localdocker', 4243),
|
||||
('127.0.0.1', 4243),
|
||||
]
|
||||
tcp_host = '127.0.0.1'
|
||||
tcp_port = 4243
|
||||
|
||||
if os.path.exists(socket_path):
|
||||
return 'unix://%s' % socket_path
|
||||
|
||||
try:
|
||||
s = socket.socket()
|
||||
s.connect((tcp_host, tcp_port))
|
||||
s.close()
|
||||
return 'http://%s:%s' % (tcp_host, tcp_port)
|
||||
except:
|
||||
pass
|
||||
for host, port in tcp_hosts:
|
||||
try:
|
||||
s = socket.create_connection((host, port), timeout=1)
|
||||
s.close()
|
||||
return 'http://%s:%s' % (host, port)
|
||||
except:
|
||||
pass
|
||||
|
||||
raise UserError("""
|
||||
Couldn't find Docker daemon - tried %s and %s:%s.
|
||||
If it's running elsewhere, specify a url with DOCKER_URL.
|
||||
""" % (socket_path, tcp_host, tcp_port))
|
||||
Couldn't find Docker daemon - tried:
|
||||
|
||||
unix://%s
|
||||
%s
|
||||
|
||||
If it's running elsewhere, specify a url with DOCKER_URL.
|
||||
""" % (socket_path, '\n'.join('tcp://%s:%s' % h for h in tcp_hosts)))
|
||||
|
|
Loading…
Reference in New Issue