diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index 1ebe044a913..05f053438a3 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -222,8 +222,14 @@ CommandLine DockerProcessImpl::fullLocalCommandLine(bool interactive) QStringList args; if (!m_setup.m_workingDirectory.isEmpty()) { - QTC_CHECK(DeviceManager::deviceForPath(m_setup.m_workingDirectory) == m_device); - args.append({"cd", m_setup.m_workingDirectory.path()}); + FilePath workingDir = m_setup.m_workingDirectory; + + if (DeviceManager::deviceForPath(workingDir) != m_device) { + QTC_CHECK(m_device->ensureReachable(workingDir)); + workingDir = workingDir.onDevice(m_device->rootPath()); + } + + args.append({"cd", workingDir.path()}); args.append("&&"); }