Skip to content

Commit

Permalink
feat: add pause option to commit api (#3159)
Browse files Browse the repository at this point in the history
add commit pause option

Signed-off-by: VincentLeeMax <[email protected]>
Co-authored-by: Milas Bowman <[email protected]>
  • Loading branch information
VincentLeeMax and milas authored Aug 14, 2023
1 parent 0618951 commit 4571f7f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docker/api/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def attach_socket(self, container, params=None, ws=False):

@utils.check_resource('container')
def commit(self, container, repository=None, tag=None, message=None,
author=None, changes=None, conf=None):
author=None, pause=True, changes=None, conf=None):
"""
Commit a container to an image. Similar to the ``docker commit``
command.
Expand All @@ -123,6 +123,7 @@ def commit(self, container, repository=None, tag=None, message=None,
tag (str): The tag to push
message (str): A commit message
author (str): The name of the author
pause (bool): Whether to pause the container before committing
changes (str): Dockerfile instructions to apply while committing
conf (dict): The configuration for the container. See the
`Engine API documentation
Expand All @@ -139,6 +140,7 @@ def commit(self, container, repository=None, tag=None, message=None,
'tag': tag,
'comment': message,
'author': author,
'pause': pause,
'changes': changes
}
u = self._url("/commit")
Expand Down
1 change: 1 addition & 0 deletions docker/models/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def commit(self, repository=None, tag=None, **kwargs):
tag (str): The tag to push
message (str): A commit message
author (str): The name of the author
pause (bool): Whether to pause the container before committing
changes (str): Dockerfile instructions to apply while committing
conf (dict): The configuration for the container. See the
`Engine API documentation
Expand Down
1 change: 1 addition & 0 deletions tests/unit/api_image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def test_commit(self):
'tag': None,
'container': fake_api.FAKE_CONTAINER_ID,
'author': None,
'pause': True,
'changes': None
},
timeout=DEFAULT_TIMEOUT_SECONDS
Expand Down

0 comments on commit 4571f7f

Please sign in to comment.