Docker can mount read-only volumes at image build time (see docker build --volume) but this is not currently possible to do via the build method.
I doubt that this makes it into docker-py before moby/moby#14080 is resolved, but nevertheless I added support in PR #1937 for it. It especially is useful if one uses a patched docker, that has support for build time volumes (e.g. Project Atomic or balena - I think Fedora and RHEL have patched-in support as well).
Closing for the reasons explained in https://github.com/docker/docker-py/pull/1937#issuecomment-398198819
Most helpful comment
I doubt that this makes it into docker-py before moby/moby#14080 is resolved, but nevertheless I added support in PR #1937 for it. It especially is useful if one uses a patched docker, that has support for build time volumes (e.g. Project Atomic or balena - I think Fedora and RHEL have patched-in support as well).