Skip to content

Commit

Permalink
Add PowerShell script to stop and remove Docker containers
Browse files Browse the repository at this point in the history
A new install.ps1 script is added to stop any running task-tower/controller or task-tower/worker Docker containers and remove them if they exist. This helps in cleaning up environment before a new deployment or for debugging purposes.
  • Loading branch information
PiotrFerenc committed May 10, 2024
1 parent 8c68de8 commit 61df963
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
$controller_container = "task-tower/controller"
$worker_container = "task-tower/worker"

# Stop the controller container if it is running
$controllerIDs = docker ps -q --filter "ancestor=$controller_container"
if ($controllerIDs) {
docker stop $controllerIDs
} else {
Write-Host "No controller container to stop"
}

# Stop the worker container if it is running
$workerIDs = docker ps -q --filter "ancestor=$worker_container"
if ($workerIDs) {
docker stop $workerIDs
} else {
Write-Host "No worker container to stop"
}

# Remove the worker container if it exists
$workerAllIDs = docker ps -aq --filter "ancestor=$worker_container"
if ($workerAllIDs) {
docker rm -f $workerAllIDs
} else {
Write-Host "No worker container to remove"
}

# Remove the controller container if it exists
$controllerAllIDs = docker ps -aq --filter "ancestor=$controller_container"
if ($controllerAllIDs) {
docker rm -f $controllerAllIDs
} else {
Write-Host "No controller container to remove"
}

0 comments on commit 61df963

Please sign in to comment.