(self)
| 45 | if self.logger: self.logger.log(type="error", content=f"Failed to stop and remove the container: {e}") |
| 46 | |
| 47 | def get_image_containers(self): |
| 48 | if not self.client: self.client = self.init_docker() |
| 49 | containers = self.client.containers.list(all=True, filters={"ancestor": self.image}) |
| 50 | infos = [] |
| 51 | for container in containers: |
| 52 | infos.append({ |
| 53 | "id": container.id, |
| 54 | "name": container.name, |
| 55 | "status": container.status, |
| 56 | "image": container.image, |
| 57 | "ports": container.ports, |
| 58 | "web_port": (container.ports.get("80/tcp") or [{}])[0].get("HostPort"), |
| 59 | "ssh_port": (container.ports.get("22/tcp") or [{}])[0].get("HostPort"), |
| 60 | # "volumes": container.volumes, |
| 61 | # "data_folder": container.volumes["/a0"], |
| 62 | }) |
| 63 | return infos |
| 64 | |
| 65 | def start_container(self) -> None: |
| 66 | if not self.client: self.client = self.init_docker() |
nothing calls this directly
no test coverage detected