diff options
| author | Joffrey F <joffrey@docker.com> | 2016-03-23 12:17:56 -0700 |
|---|---|---|
| committer | Joffrey F <joffrey@docker.com> | 2016-03-23 12:17:56 -0700 |
| commit | 6bafac0502f5c613fe06da256504c884a987dce6 (patch) | |
| tree | dda64d266e9a8337f72e2bc5e532e72e067e86ca | |
| parent | 14cc5806c5ab7c6be216ae9a9113bf75278403a3 (diff) | |
| parent | cf8311988259ff5b01a20bc04fc57d4daeccf3e7 (diff) | |
| download | docker-py-6bafac0502f5c613fe06da256504c884a987dce6.tar.gz | |
Merge branch 'dimaspivak-master'
| -rw-r--r-- | docker/api/container.py | 5 | ||||
| -rw-r--r-- | docs/api.md | 1 | ||||
| -rw-r--r-- | tests/integration/image_test.py | 14 | ||||
| -rw-r--r-- | tests/unit/image_test.py | 3 |
4 files changed, 20 insertions, 3 deletions
diff --git a/docker/api/container.py b/docker/api/container.py index ef17c27..da4ac14 100644 --- a/docker/api/container.py +++ b/docker/api/container.py @@ -40,13 +40,14 @@ class ContainerApiMixin(object): @utils.check_resource def commit(self, container, repository=None, tag=None, message=None, - author=None, conf=None): + author=None, changes=None, conf=None): params = { 'container': container, 'repo': repository, 'tag': tag, 'comment': message, - 'author': author + 'author': author, + 'changes': changes } u = self._url("/commit") return self._result(self._post_json(u, data=conf, params=params), diff --git a/docs/api.md b/docs/api.md index 3393e68..f4f1ad4 100644 --- a/docs/api.md +++ b/docs/api.md @@ -123,6 +123,7 @@ Identical to the `docker commit` command. * tag (str): The tag to push * message (str): A commit message * author (str): The name of the author +* changes (str): Dockerfile instructions to apply while committing * conf (dict): The configuration for the container. See the [Docker remote api]( https://docs.docker.com/reference/api/docker_remote_api/) for full details. diff --git a/tests/integration/image_test.py b/tests/integration/image_test.py index 825f632..9f38366 100644 --- a/tests/integration/image_test.py +++ b/tests/integration/image_test.py @@ -90,6 +90,20 @@ class CommitTest(helpers.BaseTestCase): self.assertIn('Parent', img) self.assertEqual(img['Parent'], busybox_id) + def test_commit_with_changes(self): + cid = self.client.create_container(BUSYBOX, ['touch', '/test']) + self.tmp_containers.append(cid) + self.client.start(cid) + img_id = self.client.commit( + cid, changes=['EXPOSE 8000', 'CMD ["bash"]'] + ) + self.tmp_imgs.append(img_id) + img = self.client.inspect_image(img_id) + assert 'Container' in img + assert img['Container'].startswith(cid['Id']) + assert '8000/tcp' in img['Config']['ExposedPorts'] + assert img['Config']['Cmd'] == ['bash'] + class RemoveImageTest(helpers.BaseTestCase): def test_remove(self): diff --git a/tests/unit/image_test.py b/tests/unit/image_test.py index a46e48e..8fd894c 100644 --- a/tests/unit/image_test.py +++ b/tests/unit/image_test.py @@ -101,7 +101,8 @@ class ImageTest(DockerClientTest): 'comment': None, 'tag': None, 'container': '3cc2351ab11b', - 'author': None + 'author': None, + 'changes': None }, timeout=DEFAULT_TIMEOUT_SECONDS ) |
