-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from rakshita-kaulgud/main
Issue #93 : Changes to check for docker and docker compose status on …
- Loading branch information
Showing
7 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package docker | ||
|
||
import ( | ||
"fmt" | ||
"os/exec" | ||
) | ||
|
||
// CheckDockerConfig is a function to check docker and docker-compose configuration on the host | ||
func CheckDockerConfig() error { | ||
|
||
dockerCmd := exec.Command("docker", "-v") | ||
_, err := dockerCmd.Output() | ||
if err != nil { | ||
return fmt.Errorf("An error occurred while running docker. Is docker installed on your computer?") | ||
} | ||
|
||
dockerComposeCmd := exec.Command("docker-compose", "-v") | ||
_, err = dockerComposeCmd.Output() | ||
|
||
if err != nil { | ||
return fmt.Errorf("An error occurred while running docker-compose. Is docker-compose installed on your computer?") | ||
} | ||
|
||
dockerDeamonCheck := exec.Command("docker", "ps") | ||
_, err = dockerDeamonCheck.Output() | ||
if err != nil { | ||
return fmt.Errorf("An error occurred while running docker. Is docker running on your computer?") | ||
} | ||
|
||
return nil | ||
} |