sven-lange-last commented on a change in pull request #4503: Add optional 
config for appending custom registry to user provided images
URL: https://github.com/apache/openwhisk/pull/4503#discussion_r325625604
 
 

 ##########
 File path: 
core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/docker/DockerContainerFactory.scala
 ##########
 @@ -60,10 +62,14 @@ class DockerContainerFactory(instance: InvokerInstanceId,
                                userProvidedImage: Boolean,
                                memory: ByteSize,
                                cpuShares: Int)(implicit config: WhiskConfig, 
logging: Logging): Future[Container] = {
+    val registryConfig =
+      ContainerFactory.resolveRegisterConfig(userProvidedImage, 
runtimesRegistryConfig, userImagesRegistryConfig)
+    val image =
+      if (userProvidedImage && registryConfig.url.isEmpty) Left(actionImage)
+      else Right(actionImage.localImageName(registryConfig.url))
 
 Review comment:
   Yes, since your PR does not provide a list with mappings for registry 
domains but only a single user image repository domain, all user provided image 
refs would be overwritten - regardless whether the user provided image ref 
already contains a domain or not.
   
   This current approach would lead to:
   
   * User registry config empty, user-provided image ref `image:latest` => 
Docker container factory pulls `docker.io/library/image:latest`.
   * User registry config empty, user-provided image ref 
`docker.io/library/image:latest` => Docker container factory pulls 
`docker.io/library/image:latest`.
   * User registry config `uk.icr.io`, user-provided image ref `image:latest` 
=> Docker container factory pulls `uk.icr.io/image:latest`.
     The user would probably expect to pull `uk.icr.io/library/image:latest` 
instead - but `docker pull` only inserts the "official" repository path 
`library` if `docker.io` is specified as domain. See 
https://github.com/docker/distribution/blob/14b96e55d84c367ebab6caf9f0086de0876eec72/reference/normalize.go#L88-L105.
   * User registry config `uk.icr.io`, user-provided image ref 
`path/image:latest` => Docker container factory pulls 
`uk.icr.io/path/image:latest`.
   * User registry config `uk.icr.io`, user-provided image ref 
`docker.io/path/image:latest` => Docker container factory pulls 
`uk.icr.io/path/image:latest`.
     The user would certainly not expect this outcome. If you provide an image 
ref with a domain, you would not expect that it is replaced.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to