Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2426 from ibuildthecloud/main
Browse files Browse the repository at this point in the history
Don't panic during acorn local start
  • Loading branch information
ibuildthecloud authored Jan 18, 2024
2 parents 9252aae + cb06091 commit 1fc822f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pkg/local/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,19 @@ func (c *Container) Upgrade(ctx context.Context, ignoreLocal bool) (string, stri
return "", "", err
}

if con.State == nil || !con.State.Running {
if err := c.Start(ctx); err != nil {
return "", "", err
}
if err := c.Wait(ctx); err != nil {
return "", "", err
}
con, err = c.c.ContainerInspect(ctx, ContainerName)
if err != nil {
return "", "", err
}
}

if con.Config.Image == system.DefaultImage() || (ignoreLocal && con.Config.Image == "localdev") {
return con.ID, con.NetworkSettings.Ports["6443/tcp"][0].HostPort, c.Start(ctx)
}
Expand Down Expand Up @@ -216,7 +229,7 @@ func (c *Container) Wait(ctx context.Context) error {
}
imageStatus.Success()

conStatus := pb.New("Container created")
conStatus := pb.New("Container created (to delete \"acorn local rm\")")
conStatus.Infof("Creating")

for {
Expand All @@ -236,7 +249,7 @@ func (c *Container) Wait(ctx context.Context) error {
}
}

running := pb.New("Container running")
running := pb.New("Container running (to stop \"acorn local stop\")")
running.Infof("Starting")

var port string
Expand Down

0 comments on commit 1fc822f

Please sign in to comment.