Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "canned-whale", Aliases: []string{"canned-whale"}, Short: "A docker registry export tool", Long: `A docker registry export tool implement by Go. Complete documentation is available at https://github.com/DockerAcCn/canned-whale`, RunE: func(cmd *cobra.Command, args []string) error { fmt.Println("start docker registry...") err := InitBinFS() if err != nil { return fmt.Errorf("init registry client error: %+v", err) } command := exec.Command("chmod", "a+x", "bin/registry") err = command.Run() if err != nil { return fmt.Errorf("start registry client error: %+v", err) } if configFile == "" { err := copyFSFile("bin/config.yml", "bin/config.yml") if err != nil { return fmt.Errorf("generate registry config file error: %+v", err) } configFile = "./bin/config.yml" } runRegistryCmd := exec.Command("./bin/registry", "serve", configFile) go func() { err := runRegistryCmd.Run() if err != nil { fmt.Printf("start docker registry error: %+v\n", err) } }() fmt.Println("start sync task...") client, err := client.NewSyncClient("", authFile, imageFile, "", procNum, retries, "", "", osFilterList, archFilterList) if err != nil { return fmt.Errorf("init sync client error: %+v", err) } client.Run() fmt.Println("start package...") command = exec.Command("mv", "/tmp/registry", "./registry") err = command.Run() if err != nil { return fmt.Errorf("move package error: %+v", err) } command = exec.Command("tar", "zcvf", "registry.tgz", "registry") err = command.Run() if err != nil { return fmt.Errorf("package error: %+v", err) } command = exec.Command("rm", "-rf", "./registry") err = command.Run() if err != nil { return fmt.Errorf("remove cache error: %+v", err) } runRegistryCmd.Process.Kill() path.RemovePath(cachedPath) fmt.Println("Finished") return nil }, }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.