Skip to content

Commit

Permalink
handle image id parsing from docker load output (#6)
Browse files Browse the repository at this point in the history
Co-authored-by: Saurabh <saurabh.kumar@deepfence.io>
  • Loading branch information
saurabh2253 and Saurabh authored Dec 15, 2021
1 parent d59ca74 commit 120f432
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ func (d Docker) ExtractFileSystem(imageTarPath string, outputTarPath string, ima
scanner := bufio.NewScanner(imageMsg)
for scanner.Scan() {
line := scanner.Text()
if strings.Contains(line, "Loaded image: ") {
imageId = strings.TrimSpace(strings.Replace(line,"Loaded image: ", "", 1))
break
if strings.Contains(line, "Loaded image") {
splits := strings.SplitAfterN(line,":", 2)
if len(splits) > 1 {
imageId = strings.TrimSpace(splits[1])
break
}
}
}
if imageId == "" {
Expand Down

0 comments on commit 120f432

Please sign in to comment.