summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Campbell <ijc@users.noreply.github.com>2019-03-25 12:24:54 +0000
committerGitHub <noreply@github.com>2019-03-25 12:24:54 +0000
commitc1fea8ee4a75593d2037455749bd3a68b8e07b34 (patch)
tree1a5fbc60b052a9cbb0df3a382f0a85cf4f3e8f2e
parentd38c7246a42ed8713765f3c876af05441c89f36f (diff)
parent523371e21d41e5afdb800aadec123853b8c37f2b (diff)
downloaddocker-py-c1fea8ee4a75593d2037455749bd3a68b8e07b34.tar.gz
Merge pull request #2288 from hannseman/container-run-create-volume_driver
Move volume_driver to RUN_HOST_CONFIG_KWARGS
-rw-r--r--docker/models/containers.py2
-rw-r--r--tests/integration/models_containers_test.py10
-rw-r--r--tests/unit/models_containers_test.py2
3 files changed, 12 insertions, 2 deletions
diff --git a/docker/models/containers.py b/docker/models/containers.py
index 0b0eb14..6cd33a6 100644
--- a/docker/models/containers.py
+++ b/docker/models/containers.py
@@ -964,7 +964,6 @@ RUN_CREATE_KWARGS = [
'tty',
'use_config_proxy',
'user',
- 'volume_driver',
'working_dir',
]
@@ -1028,6 +1027,7 @@ RUN_HOST_CONFIG_KWARGS = [
'userns_mode',
'uts_mode',
'version',
+ 'volume_driver',
'volumes_from',
'runtime'
]
diff --git a/tests/integration/models_containers_test.py b/tests/integration/models_containers_test.py
index 872f753..c7d897e 100644
--- a/tests/integration/models_containers_test.py
+++ b/tests/integration/models_containers_test.py
@@ -383,3 +383,13 @@ class ContainerTest(BaseIntegrationTest):
detach=True)
self.tmp_containers.append(container.id)
assert container.wait()['StatusCode'] == 1
+
+ def test_create_with_volume_driver(self):
+ client = docker.from_env(version=TEST_API_VERSION)
+ container = client.containers.create(
+ 'alpine',
+ 'sleep 300',
+ volume_driver='foo'
+ )
+ self.tmp_containers.append(container.id)
+ assert container.attrs['HostConfig']['VolumeDriver'] == 'foo'
diff --git a/tests/unit/models_containers_test.py b/tests/unit/models_containers_test.py
index f44e365..da5f0ab 100644
--- a/tests/unit/models_containers_test.py
+++ b/tests/unit/models_containers_test.py
@@ -176,6 +176,7 @@ class ContainerCollectionTest(unittest.TestCase):
'Ulimits': [{"Name": "nofile", "Soft": 1024, "Hard": 2048}],
'UsernsMode': 'host',
'UTSMode': 'host',
+ 'VolumeDriver': 'some_driver',
'VolumesFrom': ['container'],
},
healthcheck={'test': 'true'},
@@ -190,7 +191,6 @@ class ContainerCollectionTest(unittest.TestCase):
stop_signal=9,
tty=True,
user='bob',
- volume_driver='some_driver',
volumes=[
'/mnt/vol2',
'/mnt/vol1',