-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix:check docker daemon running? #2286
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import ( | |
pkg "github.com/konstructio/kubefirst-api/pkg/utils" | ||
"github.com/konstructio/kubefirst/internal/catalog" | ||
"github.com/konstructio/kubefirst/internal/cluster" | ||
"github.com/konstructio/kubefirst/internal/docker" | ||
"github.com/konstructio/kubefirst/internal/gitShim" | ||
"github.com/konstructio/kubefirst/internal/launch" | ||
"github.com/konstructio/kubefirst/internal/progress" | ||
|
@@ -34,6 +35,13 @@ func createAws(cmd *cobra.Command, args []string) error { | |
return nil | ||
} | ||
|
||
log.Info().Msg("Check Docker status") | ||
err = docker.Checkstatus() | ||
if err != nil { | ||
log.Info().Msgf("%s", err) | ||
return err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap error |
||
} | ||
|
||
progress.DisplayLogHints(40) | ||
|
||
isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ import ( | |
utils "github.com/konstructio/kubefirst-api/pkg/utils" | ||
"github.com/konstructio/kubefirst/internal/catalog" | ||
"github.com/konstructio/kubefirst/internal/cluster" | ||
"github.com/konstructio/kubefirst/internal/docker" | ||
"github.com/konstructio/kubefirst/internal/gitShim" | ||
"github.com/konstructio/kubefirst/internal/launch" | ||
"github.com/konstructio/kubefirst/internal/progress" | ||
|
@@ -32,6 +33,13 @@ func createCivo(cmd *cobra.Command, args []string) error { | |
return nil | ||
} | ||
|
||
log.Info().Msg("Check Docker status") | ||
err = docker.Checkstatus() | ||
if err != nil { | ||
log.Info().Msgf("%s", err) | ||
return err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap error |
||
} | ||
|
||
progress.DisplayLogHints(15) | ||
|
||
isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ import ( | |
utils "github.com/konstructio/kubefirst-api/pkg/utils" | ||
"github.com/konstructio/kubefirst/internal/catalog" | ||
"github.com/konstructio/kubefirst/internal/cluster" | ||
"github.com/konstructio/kubefirst/internal/docker" | ||
"github.com/konstructio/kubefirst/internal/gitShim" | ||
"github.com/konstructio/kubefirst/internal/launch" | ||
"github.com/konstructio/kubefirst/internal/progress" | ||
|
@@ -32,6 +33,13 @@ func createDigitalocean(cmd *cobra.Command, args []string) error { | |
return nil | ||
} | ||
|
||
log.Info().Msg("Check Docker status") | ||
err = docker.Checkstatus() | ||
if err != nil { | ||
log.Info().Msgf("%s", err) | ||
return err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap error |
||
} | ||
|
||
progress.DisplayLogHints(20) | ||
|
||
isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ import ( | |
utils "github.com/konstructio/kubefirst-api/pkg/utils" | ||
"github.com/konstructio/kubefirst/internal/catalog" | ||
"github.com/konstructio/kubefirst/internal/cluster" | ||
"github.com/konstructio/kubefirst/internal/docker" | ||
"github.com/konstructio/kubefirst/internal/gitShim" | ||
"github.com/konstructio/kubefirst/internal/launch" | ||
"github.com/konstructio/kubefirst/internal/progress" | ||
|
@@ -33,6 +34,13 @@ func createGoogle(cmd *cobra.Command, args []string) error { | |
return nil | ||
} | ||
|
||
log.Info().Msg("Check Docker status") | ||
err = docker.Checkstatus() | ||
if err != nil { | ||
log.Info().Msgf("%s", err) | ||
return err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap error |
||
} | ||
|
||
progress.DisplayLogHints(20) | ||
|
||
isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ import ( | |
utils "github.com/konstructio/kubefirst-api/pkg/utils" | ||
"github.com/konstructio/kubefirst-api/pkg/wrappers" | ||
"github.com/konstructio/kubefirst/internal/catalog" | ||
docker "github.com/konstructio/kubefirst/internal/docker" | ||
"github.com/konstructio/kubefirst/internal/gitShim" | ||
"github.com/konstructio/kubefirst/internal/progress" | ||
"github.com/konstructio/kubefirst/internal/segment" | ||
|
@@ -132,6 +133,13 @@ func runK3d(cmd *cobra.Command, args []string) error { | |
return err | ||
} | ||
|
||
log.Info().Msg("Check Docker status") | ||
err = docker.Checkstatus() | ||
if err != nil { | ||
log.Info().Msgf("%s", err) | ||
return err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap error |
||
} | ||
|
||
switch gitProviderFlag { | ||
case "github": | ||
key, err := internalssh.GetHostKey("github.com") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import ( | |
utils "github.com/konstructio/kubefirst-api/pkg/utils" | ||
"github.com/konstructio/kubefirst/internal/catalog" | ||
"github.com/konstructio/kubefirst/internal/cluster" | ||
"github.com/konstructio/kubefirst/internal/docker" | ||
"github.com/konstructio/kubefirst/internal/gitShim" | ||
"github.com/konstructio/kubefirst/internal/launch" | ||
"github.com/konstructio/kubefirst/internal/progress" | ||
|
@@ -35,6 +36,13 @@ func createK3s(cmd *cobra.Command, args []string) error { | |
return nil | ||
} | ||
|
||
log.Info().Msg("Check Docker status") | ||
err = docker.Checkstatus() | ||
if err != nil { | ||
log.Info().Msgf("%s", err) | ||
return err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap error |
||
} | ||
|
||
progress.DisplayLogHints(20) | ||
|
||
isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ import ( | |
utils "github.com/konstructio/kubefirst-api/pkg/utils" | ||
"github.com/konstructio/kubefirst/internal/catalog" | ||
"github.com/konstructio/kubefirst/internal/cluster" | ||
"github.com/konstructio/kubefirst/internal/docker" | ||
"github.com/konstructio/kubefirst/internal/gitShim" | ||
"github.com/konstructio/kubefirst/internal/launch" | ||
"github.com/konstructio/kubefirst/internal/progress" | ||
|
@@ -33,6 +34,13 @@ func createVultr(cmd *cobra.Command, args []string) error { | |
return nil | ||
} | ||
|
||
log.Info().Msg("Check Docker status") | ||
err = docker.Checkstatus() | ||
if err != nil { | ||
log.Info().Msgf("%s", err) | ||
return err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap error |
||
} | ||
|
||
progress.DisplayLogHints(15) | ||
|
||
isValid, catalogApps, err := catalog.ValidateCatalogApps(cliFlags.InstallCatalogApps) | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,23 @@ | ||||||
package docker | ||||||
|
||||||
import ( | ||||||
"context" | ||||||
"fmt" | ||||||
|
||||||
"github.com/docker/docker/client" | ||||||
) | ||||||
|
||||||
func Checkstatus() error { | ||||||
|
||||||
cli, err := client.NewClientWithOpts(client.FromEnv) | ||||||
if err != nil { | ||||||
return fmt.Errorf("Docker is not installed or not accessible: %w", err) | ||||||
} | ||||||
|
||||||
_, err = cli.Ping(context.Background()) | ||||||
if err != nil { | ||||||
return fmt.Errorf("Docker is not accessible: %v", err) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
|
||||||
return nil | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap the error my friend 😆