aIbrahiim commented on code in PR #36757:
URL: https://github.com/apache/beam/pull/36757#discussion_r2504611865


##########
runners/google-cloud-dataflow-java/build.gradle:
##########
@@ -372,11 +372,56 @@ def buildAndPushDockerPythonContainer = 
tasks.create("buildAndPushDockerPythonCo
           root: "apache",
           tag: project.sdk_version)
   doLast {
+    def imageExists = false
+    try {
+      exec {
+        commandLine "docker", "inspect", "--type=image", 
"${defaultDockerImageName}"
+        ignoreExitValue = false
+      }
+      imageExists = true
+    } catch (Exception e) {
+      println "Image ${defaultDockerImageName} not found locally: ${e.message}"

Review Comment:
   The reason I added this try catch block was to address a specific error we 
were seeing in the logs:
   The Docker build task (`:sdks:python:container:py39:docker`) was completing 
successfully, but when the subsequent docker inspect` command ran, the image 
wasn't found in the local Docker daemon. This happens because when using docker 
buildx with the docker container driver, the image is built into buildx's cache 
but isn't automatically loaded into the Docker daemons image store.
   
   The fallback logic try to load the image from buildx cache using docker 
buildx build --output type=docker` which forces the image into the local Docker 
daemon. If that fails, it tries to pull from the registry .
   
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to