I often need to check that my applications binary distribution embed all its shared libraries so it can work on all distros. I used to do this with
mount --bind but it’s much easier with Docker:
tar cT /dev/null | docker import - empty docker run -v /lib:/lib:ro -v /path/to/my/app:/opt/app -it empty /opt/app/bin/app
This create an empty Docker image then run a container with only
/lib mounted from the host.