fix: Docker reload
This commit is contained in:
parent
092a791cc0
commit
1a1eeb7729
1 changed files with 6 additions and 8 deletions
|
|
@ -1,10 +1,9 @@
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from python_on_whales import DockerClient
|
|
||||||
from injectable import injectable
|
from injectable import injectable
|
||||||
|
from python_on_whales import DockerClient
|
||||||
from karl.model.containers import Tree, Compose, SimpleContainer
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -15,8 +14,7 @@ class DockerService:
|
||||||
self._client = DockerClient()
|
self._client = DockerClient()
|
||||||
|
|
||||||
def reload(self, compose_path: Path):
|
def reload(self, compose_path: Path):
|
||||||
projects = self._client.compose.ps()
|
os.chdir(compose_path.parent)
|
||||||
logger.info(f"Found {len(projects)} projects")
|
self._client.compose.ps()
|
||||||
from python_on_whales.components.compose.models import ComposeProject
|
self._client.compose.down(remove_orphans=True)
|
||||||
for project in projects:
|
self._client.compose.up()
|
||||||
logger.info(f"Found project {project}")
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue