Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions internal/docker/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,23 @@ func (d *Deployer) Deploy(ctx context.Context, blueprintName string) (*Deploymen
func (d *Deployer) Destroy(dep *Deployment, printServerLogs bool) {
for _, hsDep := range dep.HS {
if printServerLogs {
// If we want the logs we gracefully stop the containers to allow
// the logs to be flushed.
x := 1 * time.Second
err := d.Docker.ContainerStop(context.Background(), hsDep.ContainerID, &x)
if err != nil {
log.Printf("Destroy: Failed to destroy container %s : %s\n", hsDep.ContainerID, err)
}

printLogs(d.Docker, hsDep.ContainerID, hsDep.ContainerID)
} else {
err := d.Docker.ContainerKill(context.Background(), hsDep.ContainerID, "KILL")
if err != nil {
log.Printf("Destroy: Failed to destroy container %s : %s\n", hsDep.ContainerID, err)
}
}
err := d.Docker.ContainerKill(context.Background(), hsDep.ContainerID, "KILL")
if err != nil {
log.Printf("Destroy: Failed to destroy container %s : %s\n", hsDep.ContainerID, err)
}
err = d.Docker.ContainerRemove(context.Background(), hsDep.ContainerID, types.ContainerRemoveOptions{

err := d.Docker.ContainerRemove(context.Background(), hsDep.ContainerID, types.ContainerRemoveOptions{
Force: true,
})
if err != nil {
Expand Down