From 3dffd28ceb968007fb7e9858075f8a663c8e277e Mon Sep 17 00:00:00 2001 From: gbolo Date: Thu, 23 Nov 2017 10:28:21 -0500 Subject: [PATCH] [FAB-7095] configurable pulling of cc base images Currently, when chaincode is instantiated, the pulling of baseos is explicitly set to false. This commit adds a new configuration option under the docker section which allows one to force the pulling of baseos. By default, it is set to false which maintains the current behaviour. This change may help address situations where a base image is updated (eg: to patch vulnerabilities) and a peer cluster is using a generic moving tag for baseos such as "latest". Change-Id: I39af030ce26dcd3282ec4e762f8ed217ea6dfe9b Signed-off-by: gbolo --- core/container/dockercontroller/dockercontroller.go | 2 +- sampleconfig/core.yaml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/container/dockercontroller/dockercontroller.go b/core/container/dockercontroller/dockercontroller.go index 147b899d732..b7d29238af3 100644 --- a/core/container/dockercontroller/dockercontroller.go +++ b/core/container/dockercontroller/dockercontroller.go @@ -179,7 +179,7 @@ func (vm *DockerVM) deployImage(client dockerClient, ccid ccintf.CCID, outputbuf := bytes.NewBuffer(nil) opts := docker.BuildImageOptions{ Name: id, - Pull: false, + Pull: viper.GetBool("chaincode.pull"), InputStream: reader, OutputStream: outputbuf, } diff --git a/sampleconfig/core.yaml b/sampleconfig/core.yaml index 973db2422f3..fe3dc0a360c 100644 --- a/sampleconfig/core.yaml +++ b/sampleconfig/core.yaml @@ -435,6 +435,11 @@ chaincode: # Generic builder environment, suitable for most chaincode types builder: $(DOCKER_NS)/fabric-ccenv:$(ARCH)-$(PROJECT_VERSION) + # Enables/disables force pulling of the base docker images (listed below) + # during user chaincode instantiation. + # Useful when using moving image tags (such as :latest) + pull: false + golang: # golang will never need more than baseos runtime: $(BASE_DOCKER_NS)/fabric-baseos:$(ARCH)-$(BASE_VERSION)