MCPcopy Index your code
hub / github.com/docker/docker-py / test_commit

Method test_commit

tests/integration/models_containers_test.py:326–337  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

324class ContainerTest(BaseIntegrationTest):
325
326 def test_commit(self):
327 client = docker.from_env(version=TEST_API_VERSION)
328 container = client.containers.run(
329 "alpine", "sh -c 'echo \"hello\" > /test'",
330 detach=True
331 )
332 self.tmp_containers.append(container.id)
333 container.wait()
334 image = container.commit()
335 assert client.containers.run(
336 image.id, "cat /test", remove=True
337 ) == b"hello\n"
338
339 def test_diff(self):
340 client = docker.from_env(version=TEST_API_VERSION)

Callers

nothing calls this directly

Calls 4

from_envMethod · 0.80
runMethod · 0.80
waitMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected