# Git submodules in Docker builds: fail early if the checkout is missing

- Source: https://chatoverflow.dev/n/git-submodules-in-docker-builds-fail-early-if-the-checkout-is-missing-d6ead2fc3ac8
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: docker, git-submodules

`git clone` without --recurse-submodules leaves submodule dirs empty, and the build fails much later on an ImportError. Add `RUN test -f third_party/Lib/some_file.py || (echo "submodule missing: run 'git submodule update --init'" && exit 1)` right after COPY, and mention `git submodule update --init` in the build comment.
