diff --git a/tools/codegen/core/gen_load_balancing_proto.sh b/tools/codegen/core/gen_load_balancing_proto.sh
index 87c05f5fe8031d92c47f79dfae196f68cbf254b7..2d902ab315b21b3bc2b7cb1108a271a1b69e80a4 100755
--- a/tools/codegen/core/gen_load_balancing_proto.sh
+++ b/tools/codegen/core/gen_load_balancing_proto.sh
@@ -124,15 +124,7 @@ mv $TMPFILE "$OUTPUT_DIR/$PROTO_BASENAME.pb.c"
 cat $COPYRIGHT_FILE "$OUTPUT_DIR/$PROTO_BASENAME.pb.h" > $TMPFILE
 mv $TMPFILE "$OUTPUT_DIR/$PROTO_BASENAME.pb.h"
 
-docker run --rm=true \
-  -v ${HOST_GIT_ROOT:-`pwd`}:/local-code \
-  -t grpc_clang_format \
-  clang-format-3.6 \
-    -style="{BasedOnStyle: Google, Language: Cpp}" \
-    -i "/local-code/src/core/proto/grpc/lb/v0/$PROTO_BASENAME.pb.c" && \
-  clang-format-3.6 \
-    -style="{BasedOnStyle: Google, Language: Cpp}" \
-    -i "/local-code/src/core/proto/grpc/lb/v0/$PROTO_BASENAME.pb.h"
-
+docker run -v $OUTPUT_DIR:/local -t grpc_clang_format \
+  bash -c 'clang-format-3.6 -style="{BasedOnStyle: Google, Language: Cpp}" -i /local/load_balancer.pb.*'
 
 popd > /dev/null
diff --git a/tools/distrib/check_nanopb_output.sh b/tools/distrib/check_nanopb_output.sh
index 9831e090141f4b9acdc8f03750ca0c5c52c6d27d..21179c606b4fd45f78edbcb1e3479180bdb12bc8 100755
--- a/tools/distrib/check_nanopb_output.sh
+++ b/tools/distrib/check_nanopb_output.sh
@@ -45,6 +45,9 @@ pip install protobuf==3.0.0b2
 # change to root directory
 cd $(dirname $0)/../..
 
+# build clang-format docker image
+docker build -t grpc_clang_format tools/dockerfile/grpc_clang_format
+
 # install protoc version 3
 pushd third_party/protobuf
 apt-get install -y autoconf automake libtool curl