Make docker permissions errors more obvious
This commit is contained in:
parent
133b7a9b03
commit
6156947406
17
main.go
17
main.go
@ -61,6 +61,14 @@ func checkRequiredUtils() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkDockerPermissions() (err error) {
|
||||||
|
output, err := exec.Command("docker", "ps").CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
err = fmt.Errorf(string(output))
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := kingpin.New(
|
app := kingpin.New(
|
||||||
"out-of-tree",
|
"out-of-tree",
|
||||||
@ -140,6 +148,15 @@ func main() {
|
|||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = checkDockerPermissions()
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
log.Println("You have two options:")
|
||||||
|
log.Println("\t1. Add user to group docker;")
|
||||||
|
log.Println("\t2. Run out-of-tree with sudo.")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
if !exists(usr.HomeDir + "/.out-of-tree/images") {
|
if !exists(usr.HomeDir + "/.out-of-tree/images") {
|
||||||
log.Println("No ~/.out-of-tree/images: " +
|
log.Println("No ~/.out-of-tree/images: " +
|
||||||
"Probably you need to run `out-of-tree bootstrap`" +
|
"Probably you need to run `out-of-tree bootstrap`" +
|
||||||
|
Loading…
Reference in New Issue
Block a user