MCPcopy Create free account
hub / github.com/catid/supercharger / recreate_container

Method recreate_container

codegen/docker_execute.py:15–35  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

13 self.container = None
14
15 def recreate_container(self):
16 self.shutdown()
17
18 # Pull the Python image
19 self.client.images.pull(self.image)
20
21 # Create a container and run an infinite loop to keep it alive
22 self.container = self.client.containers.run(
23 self.image,
24 command="bash -c 'while true; do sleep 1; done'",
25 volumes={
26 self.full_source_path: {
27 'bind': f"/{self.sources_dirname}",
28 'mode': 'rw'
29 }
30 },
31 working_dir=f"/{self.sources_dirname}",
32 stderr=True,
33 stdout=True,
34 detach=True,
35 )
36
37 def shutdown(self):
38 if not self.container is None:

Callers 1

executeMethod · 0.95

Calls 2

shutdownMethod · 0.95
runMethod · 0.80

Tested by

no test coverage detected