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>
This commit is contained in:
VincentLeeMax 2023-08-15 02:52:38 +08:00 committed by GitHub
parent 0618951093
commit 4571f7f9b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View File

@ -112,7 +112,7 @@ class ContainerApiMixin:
@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.
@ -123,6 +123,7 @@ class ContainerApiMixin:
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
@ -139,6 +140,7 @@ class ContainerApiMixin:
'tag': tag,
'comment': message,
'author': author,
'pause': pause,
'changes': changes
}
u = self._url("/commit")

View File

@ -121,6 +121,7 @@ class Container(Model):
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

View File

@ -102,6 +102,7 @@ class ImageTest(BaseAPIClientTest):
'tag': None,
'container': fake_api.FAKE_CONTAINER_ID,
'author': None,
'pause': True,
'changes': None
},
timeout=DEFAULT_TIMEOUT_SECONDS