Skip to content

Commit

Permalink
[FAB-4748]: Add docker image info to the error log
Browse files Browse the repository at this point in the history
Currently while deploying new chaincode and upon receiving the erorr of
"no such image", there is no additional information which will allow to
trace the problem and clearly understand what image is missing. Commit
takes care to append into error message additional information.

Change-Id: I6ddc83696861e7699eb11ee248f79f0d4180d404
Signed-off-by: Artem Barger <bartem@il.ibm.com>
  • Loading branch information
C0rWin committed Jun 15, 2017
1 parent a747232 commit 9bb49ee
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/container/dockercontroller/dockercontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,13 @@ func (vm *DockerVM) Start(ctxt context.Context, ccid ccintf.CCID,
//if image not found try to create image and retry
if err == docker.ErrNoSuchImage {
if builder != nil {
dockerLogger.Debugf("start-could not find image ...attempt to recreate image %s", err)
dockerLogger.Debugf("start-could not find image <%s> (container id <%s>), because of <%s>..."+
"attempt to recreate image", imageID, containerID, err)

reader, err1 := builder()
if err1 != nil {
dockerLogger.Errorf("Error creating image builder: %s", err1)
dockerLogger.Errorf("Error creating image builder for image <%s> (container id <%s>), "+
"because of <%s>", imageID, containerID, err1)
}

if err1 = vm.deployImage(client, ccid, args, env, reader); err1 != nil {
Expand All @@ -249,11 +251,11 @@ func (vm *DockerVM) Start(ctxt context.Context, ccid ccintf.CCID,
return err1
}
} else {
dockerLogger.Errorf("start-could not find image: %s", err)
dockerLogger.Errorf("start-could not find image <%s>, because of %s", imageID, err)
return err
}
} else {
dockerLogger.Errorf("start-could not recreate container: %s", err)
dockerLogger.Errorf("start-could not recreate container <%s>, because of %s", containerID, err)
return err
}
}
Expand Down

0 comments on commit 9bb49ee

Please sign in to comment.