diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index 5a4b7d61811..712c960ef0e 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -1105,12 +1105,21 @@ void DockerDeviceFactory::shutdownExistingDevices() bool DockerDevicePrivate::addTemporaryMount(const FilePath &path, const FilePath &containerPath) { - bool alreadyAdded = anyOf(m_temporaryMounts, [containerPath](const TemporaryMountInfo &info) { - return info.containerPath == containerPath; - }); + const bool alreadyAdded = anyOf(m_temporaryMounts, + [containerPath](const TemporaryMountInfo &info) { + return info.containerPath == containerPath; + }); + if (alreadyAdded) return false; + const bool alreadyManuallyAdded = anyOf(m_data.mounts, [path](const QString &mount) { + return mount == path.path(); + }); + + if (alreadyManuallyAdded) + return false; + const TemporaryMountInfo newMount{path, containerPath}; const expected_str result = isValidMountInfo(newMount);