WORKDIR /
 $vpp_install_skip_sysctl_envvar
 ENV VPP_ZOMBIE_NOCHECK="1"
-# TODO: Mount ccache volume into docker container, then remove this.
-ENV CCACHE_DISABLE="1"
+ENV CCACHE_DIR="/scratch/ccache"
 EOF
     generate_apt_dockerfile_clean
 }
 
 # CI Runtime Environment
 WORKDIR /
 ENV VPP_ZOMBIE_NOCHECK="1"
-# TODO: Mount ccache volume into docker container, then remove this.
-ENV CCACHE_DISABLE="1"
+ENV CCACHE_DIR="/scratch/ccache"
 EOF
     generate_dnf_dockerfile_clean
 }
 
 # CI Runtime Environment
 WORKDIR /
 ENV VPP_ZOMBIE_NOCHECK="1"
-# TODO: Mount ccache volume into docker container, then remove this.
-ENV CCACHE_DISABLE="1"
+ENV CCACHE_DIR="/scratch/ccache"
 EOF
     generate_yum_dockerfile_clean
 }
 
+++ /dev/null
----
-templates:
-  - image: "fdiotools/builder-centos7:prod-aarch64"
-    labels: "builder-centos7-prod-aarch64"
-    prefix: "builder-centos7-prod-aarch64"
 
     labels: "builder-centos7-prod-x86_64"
     memory: 14000
     prefix: "builder-centos7-prod-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
+++ /dev/null
----
-templates:
-  - image: "fdiotools/builder-centos7:sandbox-aarch64"
-    labels: "builder-centos7-sandbox-aarch64"
-    prefix: "builder-centos7-sandbox-aarch64"
 
     labels: "builder-centos7-sandbox-x86_64"
     memory: 14000
     prefix: "builder-centos7-sandbox-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
+++ /dev/null
----
-templates:
-  - image: "fdiotools/builder-centos7:test-aarch64"
-    labels: "builder-centos7-test-aarch64"
-    prefix: "builder-centos7-test-aarch64"
 
     labels: "builder-centos7-test-x86_64"
     memory: 14000
     prefix: "builder-centos7-test-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
   - image: "fdiotools/builder-centos8:prod-aarch64"
     labels: "builder-centos8-prod-aarch64"
     prefix: "builder-centos8-prod-aarch64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
     labels: "builder-centos8-prod-x86_64"
     memory: 14000
     prefix: "builder-centos8-prod-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
   - image: "fdiotools/builder-centos8:sandbox-aarch64"
     labels: "builder-centos8-sandbox-aarch64"
     prefix: "builder-centos8-sandbox-aarch64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
     labels: "builder-centos8-sandbox-x86_64"
     memory: 14000
     prefix: "builder-centos8-sandbox-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
   - image: "fdiotools/builder-centos8:test-aarch64"
     labels: "builder-centos8-test-aarch64"
     prefix: "builder-centos8-test-aarch64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
     labels: "builder-centos8-test-x86_64"
     memory: 14000
     prefix: "builder-centos8-test-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
+++ /dev/null
----
-templates:
-  - image: "fdiotools/builder-debian10:prod-aarch64"
-    labels: "builder-debian10-prod-aarch64"
-    prefix: "builder-debian10-prod-aarch64"
 
     labels: "builder-debian10-prod-x86_64"
     memory: 14000
     prefix: "builder-debian10-prod-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
+++ /dev/null
----
-templates:
-  - image: "fdiotools/builder-debian10:sandbox-aarch64"
-    labels: "builder-debian10-sandbox-aarch64"
-    prefix: "builder-debian10-sandbox-aarch64"
 
     labels: "builder-debian10-sandbox-x86_64"
     memory: 14000
     prefix: "builder-debian10-sandbox-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
+++ /dev/null
----
-templates:
-  - image: "fdiotools/builder-debian10:test-aarch64"
-    labels: "builder-debian10-test-aarch64"
-    prefix: "builder-debian10-test-aarch64"
 
     labels: "builder-debian10-test-x86_64"
     memory: 14000
     prefix: "builder-debian10-test-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
+++ /dev/null
----
-templates:
-  - image: "fdiotools/builder-debian9:prod-aarch64"
-    labels: "builder-debian9-prod-aarch64"
-    prefix: "builder-debian9-prod-aarch64"
 
     labels: "builder-debian9-prod-x86_64"
     memory: 14000
     prefix: "builder-debian9-prod-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
+++ /dev/null
----
-templates:
-  - image: "fdiotools/builder-debian9:sandbox-aarch64"
-    labels: "builder-debian9-sandbox-aarch64"
-    prefix: "builder-debian9-sandbox-aarch64"
 
     labels: "builder-debian9-sandbox-x86_64"
     memory: 14000
     prefix: "builder-debian9-sandbox-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
+++ /dev/null
----
-templates:
-  - image: "fdiotools/builder-debian9:test-aarch64"
-    labels: "builder-debian9-test-aarch64"
-    prefix: "builder-debian9-test-aarch64"
 
     labels: "builder-debian9-test-x86_64"
     memory: 14000
     prefix: "builder-debian9-test-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
   - image: "fdiotools/builder-ubuntu1804:prod-aarch64"
     labels: "builder-ubuntu1804-prod-aarch64"
     prefix: "builder-ubuntu1804-prod-aarch64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
     labels: "builder-ubuntu1804-prod-x86_64"
     memory: 14000
     prefix: "builder-ubuntu1804-prod-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
   - image: "fdiotools/builder-ubuntu1804:sandbox-aarch64"
     labels: "builder-ubuntu1804-sandbox-aarch64"
     prefix: "builder-ubuntu1804-sandbox-aarch64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
     labels: "builder-ubuntu1804-sandbox-x86_64"
     memory: 14000
     prefix: "builder-ubuntu1804-sandbox-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
   - image: "fdiotools/builder-ubuntu1804:test-aarch64"
     labels: "builder-ubuntu1804-test-aarch64"
     prefix: "builder-ubuntu1804-test-aarch64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
     labels: "builder-ubuntu1804-test-x86_64"
     memory: 14000
     prefix: "builder-ubuntu1804-test-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
   - image: "fdiotools/builder-ubuntu2004:prod-aarch64"
     labels: "builder-ubuntu2004-prod-aarch64"
     prefix: "builder-ubuntu2004-prod-aarch64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
     labels: "builder-ubuntu2004-prod-x86_64"
     memory: 14000
     prefix: "builder-ubuntu2004-prod-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
   - image: "fdiotools/builder-ubuntu2004:sandbox-aarch64"
     labels: "builder-ubuntu2004-sandbox-aarch64"
     prefix: "builder-ubuntu2004-sandbox-aarch64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
     labels: "builder-ubuntu2004-sandbox-x86_64"
     memory: 14000
     prefix: "builder-ubuntu2004-sandbox-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
   - image: "fdiotools/builder-ubuntu2004:test-aarch64"
     labels: "builder-ubuntu2004-test-aarch64"
     prefix: "builder-ubuntu2004-test-aarch64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
     labels: "builder-ubuntu2004-test-x86_64"
     memory: 14000
     prefix: "builder-ubuntu2004-test-x86_64"
+    hostVolumes: "/tmp/ccache:/scratch/ccache"
 
 echo "$long_line"
 echo "DNS nameserver config in '/etc/resolv.conf':"
 cat /etc/resolv.conf || true
+
+if [ -n "${CCACHE_DIR:-}" ] ; then
+    echo "$long_line"
+    if [ -d "$CCACHE_DIR" ] ; then
+        num_ccache_files="$(find $CCACHE_DIR -type f | wc -l)"
+        ccache_conf="$CCACHE_DIR/ccache.conf"
+        echo "CCACHE_DIR='$CCACHE_DIR' ($num_ccache_files ccache files):"
+        du -sh /tmp/ccache
+        df -h /tmp/ccache
+        ls -l $CCACHE_DIR
+        unset -v CCACHE_DISABLE
+        if [ -f "$ccache_conf" ] ; then
+            echo "Contents of $ccache_conf:"
+            cat $ccache_conf
+        fi
+    else
+        echo "CCACHE_DIR='$CCACHE_DIR' is missing, disabling CCACHE..."
+        unset -v CCACHE_DIR
+        export CCACHE_DISABLE="1"
+        echo "CCACHE_DISABLE='${CCACHE_DISABLE:-}'"
+    fi
+fi
 echo "$long_line"