intermediaryDirs() was called with the full path including the leaf component, causing --dir to be emitted for files like ~/.npmrc. This created a directory at that path, making the subsequent --ro-bind fail with "Can't create file at ...: Is a directory". Now checks isDirectory() and uses filepath.Dir() for file paths so intermediary dirs are only created up to the parent.