Skip to content

Commit 4571f7f

Browse files
VincentLeeMaxmilas
andauthored
feat: add pause option to commit api (#3159)
add commit pause option Signed-off-by: VincentLeeMax <lichlee@yeah.net> Co-authored-by: Milas Bowman <milas.bowman@docker.com>
1 parent 0618951 commit 4571f7f

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

docker/api/container.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def attach_socket(self, container, params=None, ws=False):
112112

113113
@utils.check_resource('container')
114114
def commit(self, container, repository=None, tag=None, message=None,
115-
author=None, changes=None, conf=None):
115+
author=None, pause=True, changes=None, conf=None):
116116
"""
117117
Commit a container to an image. Similar to the ``docker commit``
118118
command.
@@ -123,6 +123,7 @@ def commit(self, container, repository=None, tag=None, message=None,
123123
tag (str): The tag to push
124124
message (str): A commit message
125125
author (str): The name of the author
126+
pause (bool): Whether to pause the container before committing
126127
changes (str): Dockerfile instructions to apply while committing
127128
conf (dict): The configuration for the container. See the
128129
`Engine API documentation
@@ -139,6 +140,7 @@ def commit(self, container, repository=None, tag=None, message=None,
139140
'tag': tag,
140141
'comment': message,
141142
'author': author,
143+
'pause': pause,
142144
'changes': changes
143145
}
144146
u = self._url("/commit")

docker/models/containers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def commit(self, repository=None, tag=None, **kwargs):
121121
tag (str): The tag to push
122122
message (str): A commit message
123123
author (str): The name of the author
124+
pause (bool): Whether to pause the container before committing
124125
changes (str): Dockerfile instructions to apply while committing
125126
conf (dict): The configuration for the container. See the
126127
`Engine API documentation

tests/unit/api_image_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def test_commit(self):
102102
'tag': None,
103103
'container': fake_api.FAKE_CONTAINER_ID,
104104
'author': None,
105+
'pause': True,
105106
'changes': None
106107
},
107108
timeout=DEFAULT_TIMEOUT_SECONDS

0 commit comments

Comments
 (0)