Skip to content

Commit 6c92431

Browse files
committed
Merge branch '1.3.0-rc0'
2 parents be73aaf + f0a9c80 commit 6c92431

File tree

5 files changed

+81
-2
lines changed

5 files changed

+81
-2
lines changed

docker/utils/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ def convert_port_bindings(port_bindings):
174174

175175

176176
def convert_volume_binds(binds):
177+
if isinstance(binds, list):
178+
return binds
179+
177180
result = []
178181
for k, v in binds.items():
179182
if isinstance(v, dict):

docker/version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version = "1.2.3-dev"
2-
version_info = tuple([int(d) for d in version.replace("-dev", "").split(".")])
1+
version = "1.2.3-rc1"
2+
version_info = tuple([int(d) for d in version.split("-")[0].split(".")])

docs/change_log.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,39 @@
11
Change Log
22
==========
33

4+
1.2.3
5+
-----
6+
7+
[List of PRs / issues for this release](https://github.com/docker/docker-py/issues?q=milestone%3A1.2.3+is%3Aclosed)
8+
9+
### Deprecation warning
10+
11+
* Passing host config in the `Client.start` method is now deprecated. Please use the
12+
`host_config` in `Client.create_container` instead.
13+
14+
### Features
15+
16+
* Added support for `privileged` param in `Client.exec_create`
17+
(only available in API >= 1.19)
18+
19+
### Bugfixes
20+
21+
* Fixed a bug where the `read_only` param in host_config wasn't handled
22+
properly.
23+
* Fixed a bug in `Client.execute` (this method is still deprecated).
24+
* The `cpuset` param in `Client.create_container` is also passed as
25+
the `CpusetCpus` param (`Cpuset` deprecated in recent versions of the API)
26+
* Fixed an issue with integration tests being run inside a container
27+
(`make integration-test`)
28+
* Fixed a bug where an empty string would be considered a valid container ID
29+
or image ID.
30+
* Fixed a bug in `Client.insert`
31+
32+
33+
### Documentation
34+
35+
* Various fixes
36+
437
1.2.2
538
-----
639

docs/volumes.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,16 @@ container_id = c.create_container(
1919
})
2020
)
2121
```
22+
23+
You can alternatively specify binds as a list. This code is equivalent to the
24+
example above:
25+
26+
```python
27+
container_id = c.create_container(
28+
'busybox', 'ls', volumes=['/mnt/vol1', '/mnt/vol2'],
29+
host_config=docker.utils.create_host_config(binds=[
30+
'/home/user1/:/mnt/vol2',
31+
'/var/www:/mnt/vol1:ro',
32+
])
33+
)
34+
```

tests/test.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,36 @@ def test_create_container_with_binds_rw(self):
808808
DEFAULT_TIMEOUT_SECONDS
809809
)
810810

811+
def test_create_container_with_binds_list(self):
812+
try:
813+
self.client.create_container(
814+
'busybox', 'true', host_config=create_host_config(
815+
binds=[
816+
"/tmp:/mnt/1:ro",
817+
"/tmp:/mnt/2",
818+
],
819+
)
820+
)
821+
except Exception as e:
822+
self.fail('Command should not raise exception: {0}'.format(e))
823+
824+
args = fake_request.call_args
825+
self.assertEqual(args[0][0], url_prefix +
826+
'containers/create')
827+
expected_payload = self.base_create_payload()
828+
expected_payload['HostConfig'] = create_host_config()
829+
expected_payload['HostConfig']['Binds'] = [
830+
"/tmp:/mnt/1:ro",
831+
"/tmp:/mnt/2",
832+
]
833+
self.assertEqual(json.loads(args[1]['data']), expected_payload)
834+
self.assertEqual(args[1]['headers'],
835+
{'Content-Type': 'application/json'})
836+
self.assertEqual(
837+
args[1]['timeout'],
838+
DEFAULT_TIMEOUT_SECONDS
839+
)
840+
811841
def test_create_container_with_port_binds(self):
812842
self.maxDiff = None
813843
try:

0 commit comments

Comments
 (0)