I'm using Google Cloud build to do a build of my project and I can't figure out a way to silence the output from Docker while it's pulling the image to use for a given build step. For instance, say I have a cloudbuild.yaml
file like so:
steps:
- name: 'gradle:6.6.1-jdk11'
entrypoint: bash
args:
- -c
- |
echo "bla"
When I run this build the first 40(!) lines of the build step consist of:
Starting Step #0
Step #0 - "Build & push container": Pulling image: gradle:6.6.1-jdk11
Step #0 - "Build & push container": 6.6.1-jdk11: Pulling from library/gradle
Step #0 - "Build & push container": 5d9821c94847: Pulling fs layer
Step #0 - "Build & push container": a610eae58dfc: Pulling fs layer
Step #0 - "Build & push container": a40e0eb9f140: Pulling fs layer
Step #0 - "Build & push container": 1854bb447e96: Pulling fs layer
Step #0 - "Build & push container": efdba649c66e: Pulling fs layer
Step #0 - "Build & push container": 5541276c408d: Pulling fs layer
Step #0 - "Build & push container": 38817ec8e266: Pulling fs layer
Step #0 - "Build & push container": db18551b94a0: Pulling fs layer
Step #0 - "Build & push container": 1854bb447e96: Waiting
Step #0 - "Build & push container": efdba649c66e: Waiting
Step #0 - "Build & push container": 5541276c408d: Waiting
Step #0 - "Build & push container": 38817ec8e266: Waiting
Step #0 - "Build & push container": db18551b94a0: Waiting
Step #0 - "Build & push container": a610eae58dfc: Verifying Checksum
Step #0 - "Build & push container": a610eae58dfc: Download complete
Step #0 - "Build & push container": a40e0eb9f140: Verifying Checksum
Step #0 - "Build & push container": a40e0eb9f140: Download complete
Step #0 - "Build & push container": 5d9821c94847: Verifying Checksum
Step #0 - "Build & push container": 5d9821c94847: Download complete
Step #0 - "Build & push container": 1854bb447e96: Verifying Checksum
Step #0 - "Build & push container": 1854bb447e96: Download complete
Step #0 - "Build & push container": 5541276c408d: Verifying Checksum
Step #0 - "Build & push container": 5541276c408d: Download complete
Step #0 - "Build & push container": efdba649c66e: Verifying Checksum
Step #0 - "Build & push container": efdba649c66e: Download complete
Step #0 - "Build & push container": 38817ec8e266: Verifying Checksum
Step #0 - "Build & push container": 38817ec8e266: Download complete
Step #0 - "Build & push container": db18551b94a0: Verifying Checksum
Step #0 - "Build & push container": db18551b94a0: Download complete
Step #0 - "Build & push container": 5d9821c94847: Pull complete
Step #0 - "Build & push container": a610eae58dfc: Pull complete
Step #0 - "Build & push container": a40e0eb9f140: Pull complete
Step #0 - "Build & push container": 1854bb447e96: Pull complete
Step #0 - "Build & push container": efdba649c66e: Pull complete
Step #0 - "Build & push container": 5541276c408d: Pull complete
Step #0 - "Build & push container": 38817ec8e266: Pull complete
Step #0 - "Build & push container": db18551b94a0: Pull complete
Step #0 - "Build & push container": Digest: sha256:c40a882448431c71719d33939ee5418db2333e3380e9940f632cdb597d230dcc
Step #0 - "Build & push container": Status: Downloaded newer image for gradle:6.6.1-jdk11
Step #0 - "Build & push container": docker.io/library/gradle:6.6.1-jdk11
This is info I don't need, and I'd like to turn off the logging of the pull
process, but I can't find any configuration option to do so.
I've figured out a, well, not really a solution, but more of a workaround. If you precede the step in which you actually do something with the image with a step that pulls the image with the
-q
switch enabled you'll get a lot less noise. The trick is to do thedocker pull
with a Google image that's already cached on the Cloud Build node (gcr.io/cloud-builders/docker
in this case) so it doesn't have to fetch that one either. The YAML looks like this:And the output looks like this:
It's not quite ideal because the extra step takes Cloud Build longer than just pulling the image (not really sure why) but it does get rid of a lot of unnecessary log lines.