Fix .dockerignore when ignoring unreadable dirs

This replaces #6869 fixing an issue were the error is not returned. 

Closes #6869