Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pause option to commit api #3159

Merged
merged 2 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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