Skip to content

Commit

Permalink
Add error checking to container cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtomlinson committed Aug 18, 2022
1 parent 3569a94 commit 26ed077
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/container/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,20 @@ func (c *DockerContainer) Start() error {
return err
}
if info.State.Status == "exited" {
c.Remove()
err := c.Remove()
if err != nil {
return err
}
return errors.New("container failed to start")
}
if info.State.Running {
break
}
if time.Since(startTime) > (time.Second * 10) {
c.Remove()
err := c.Remove()
if err != nil {
return err
}
return errors.New("container failed to start after 10 seconds")
}
time.Sleep(time.Second)
Expand Down

0 comments on commit 26ed077

Please sign in to comment.