|
|
|
@ -98,6 +98,7 @@ func main() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !exist() {
|
|
|
|
|
createImage()
|
|
|
|
|
create()
|
|
|
|
|
start()
|
|
|
|
|
}
|
|
|
|
@ -234,3 +235,22 @@ func delete(bypassError bool) {
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func createImage() {
|
|
|
|
|
client := resty.New()
|
|
|
|
|
|
|
|
|
|
resp, err := client.R().
|
|
|
|
|
SetHeader("x-forwarded-user", authUser).
|
|
|
|
|
Post(fmt.Sprintf("%s://%s/images/create?fromImage=%s", proxyScheme, proxyHost, imageName))
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println(err)
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt.Println(string(resp.Body()))
|
|
|
|
|
|
|
|
|
|
if resp.IsError() {
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|