aboutsummaryrefslogtreecommitdiff
path: root/tools/cru-py/cru/service/docker.py
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2024-11-11 01:12:29 +0800
committerYuqian Yang <crupest@crupest.life>2024-12-22 17:45:13 +0800
commitb834953fa61d816b9a955640ad12d244316ce904 (patch)
tree4197980a04943b42941d3fce7cb16d1f7ea400bd /tools/cru-py/cru/service/docker.py
parent7e85627eb0d0126baf1e698ffdeae0f3c5fc693d (diff)
downloadcrupest-b834953fa61d816b9a955640ad12d244316ce904.tar.gz
crupest-b834953fa61d816b9a955640ad12d244316ce904.tar.bz2
crupest-b834953fa61d816b9a955640ad12d244316ce904.zip
HALF WORK: 2024.12.22
code.
Diffstat (limited to 'tools/cru-py/cru/service/docker.py')
-rw-r--r--tools/cru-py/cru/service/docker.py24
1 files changed, 0 insertions, 24 deletions
diff --git a/tools/cru-py/cru/service/docker.py b/tools/cru-py/cru/service/docker.py
deleted file mode 100644
index 5958f4f..0000000
--- a/tools/cru-py/cru/service/docker.py
+++ /dev/null
@@ -1,24 +0,0 @@
-import shutil
-import subprocess
-
-from .._util import L
-
-
-class DockerController:
- DOCKER_BIN_NAME = "docker"
-
- def __init__(self, docker_bin: None | str = None) -> None:
- self._docker_bin = docker_bin
-
- @property
- def docker_bin(self) -> str:
- if self._docker_bin is None:
- self._docker_bin = shutil.which(self.DOCKER_BIN_NAME)
- return self._docker_bin
-
- def list_containers(self) -> L[str]:
- p = subprocess.run([self.docker_bin, "container", "ls", ""], capture_output=True)
- return p.stdout.decode("utf-8").splitlines()
-
- def restart_container(self, container_name: str) -> None:
- subprocess.run([self.docker_bin, "restart", container_name]) \ No newline at end of file