Docker: Switch Linux file handling to docker --exec by default

Also on Linux, where there's actually a choice.

It's slower, but less fragile when it comes to user ids
and/or file system permissions.

Change-Id: I811612fcff65fad50be18bed21150f6ca7fae93c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2022-01-11 14:40:03 +01:00
parent 79ce29b5a1
commit 3342d4477c
2 changed files with 10 additions and 1 deletions

View File

@@ -396,6 +396,13 @@ public:
data.useLocalUidGid = on; data.useLocalUidGid = on;
}); });
// This tries to find the directory in the host file system that corresponds to the
// docker container root file system, which is a merge of the layers from the
// container image and the volumes mapped using -v on container startup.
//
// Accessing files there is much faster than using 'docker exec', but conceptually
// only works on Linux, and is restricted there by proper matching of user
// permissions between host and container.
m_usePathMapping = new QCheckBox(tr("Use local file path mapping")); m_usePathMapping = new QCheckBox(tr("Use local file path mapping"));
m_usePathMapping->setToolTip(tr("Maps docker filesystem to a local directory.")); m_usePathMapping->setToolTip(tr("Maps docker filesystem to a local directory."));
m_usePathMapping->setChecked(data.useFilePathMapping); m_usePathMapping->setChecked(data.useFilePathMapping);
@@ -960,8 +967,10 @@ void DockerDevicePrivate::tryCreateLocalFileAccess()
} }
return; return;
} }
if (!DockerPlugin::isDaemonRunning().value_or(false)) if (!DockerPlugin::isDaemonRunning().value_or(false))
return; return;
QtcProcess proc; QtcProcess proc;
proc.setCommand({"docker", {"inspect", "--format={{.GraphDriver.Data.MergedDir}}", m_container}}); proc.setCommand({"docker", {"inspect", "--format={{.GraphDriver.Data.MergedDir}}", m_container}});
LOG(proc.commandLine().toUserOutput()); LOG(proc.commandLine().toUserOutput());

View File

@@ -44,7 +44,7 @@ public:
QString tag; QString tag;
QString size; QString size;
bool useLocalUidGid = true; bool useLocalUidGid = true;
bool useFilePathMapping = true; bool useFilePathMapping = false;
QStringList mounts; QStringList mounts;
}; };