Skip to content

Commit e15b3bb

Browse files
committed
allow docker client to connect to a remote host
to run the tests on a host without using the default unix socket, it's now possible to specify: DOCKER_HOST=tcp://localdocker:4243 env/bin/python setup.py test
1 parent 272c1f8 commit e15b3bb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/integration_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@
2828
# FIXME: missing tests for
2929
# export; history; import_image; insert; port; push; tag; get; load
3030

31+
DEFAULT_BASE_URL = os.environ.get('DOCKER_HOST')
32+
3133

3234
class BaseTestCase(unittest.TestCase):
3335
tmp_imgs = []
3436
tmp_containers = []
3537
tmp_folders = []
3638

3739
def setUp(self):
38-
self.client = docker.Client(timeout=5)
40+
self.client = docker.Client(base_url=DEFAULT_BASE_URL, timeout=5)
3941
self.tmp_imgs = []
4042
self.tmp_containers = []
4143
self.tmp_folders = []
@@ -910,6 +912,6 @@ def runTest(self):
910912

911913

912914
if __name__ == '__main__':
913-
c = docker.Client()
915+
c = docker.Client(base_url=DEFAULT_BASE_URL)
914916
c.pull('busybox')
915917
unittest.main()

0 commit comments

Comments
 (0)