in container/go/cmd/extract_config/extract_config.go [36:70]
func main() {
flag.Parse()
if *imageTar == "" {
log.Fatalln("Required option -imageTar was not specified.")
}
if *outputConfig == "" {
log.Fatalln("Required option -outputConfig was not specified.")
}
if *outputManifest == "" {
log.Fatalln("Required option -outputManifest was not specified.")
}
img, err := tarball.ImageFromPath(*imageTar, nil)
if err != nil {
log.Fatalf("Unable to load docker image from %s: %v", *imageTar, err)
}
// Write the config file contents to the ouput file specified withh permissions 0644.
configContent, err := img.RawConfigFile()
if err != nil {
log.Fatalf("Failed to read config file: %v", err)
}
if err := ioutil.WriteFile(*outputConfig, configContent, 0644); err != nil {
log.Fatalf("Failed to write config file contents to %s: %v", *outputConfig, err)
}
// Write the manifest file contents to the manifestoutput file specified with permissions 0644.
manifestContent, err := img.RawManifest()
if err != nil {
log.Fatalf("Failed to read manifest file: %v", err)
}
if err := ioutil.WriteFile(*outputManifest, manifestContent, 0644); err != nil {
log.Fatalf("Failed to write manifest file contents to %s: %v", *outputManifest, err)
}
}