为 Docker 设备设置首选项
注意: 启用 Docker 插件才能使用。
为 Docker 设备设置首选项:
- 转到首选项>Devices >Devices 。
- 在Device 中,选择一个 Docker 设备。
下表总结了可以设置的首选项。
选项 | 值 |
---|---|
Run as outside user | 在 Linux 和 macOS 上,设置在 Docker 容器中运行Qt Creator 的用户的用户 ID 和组 ID。此选项不适用于 Windows。 |
Do not modify entry point | 阻止Qt Creator 修改映像的入口点。确保映像的入口点不会立即退出。 |
Enable flags needed for LLDB | 在容器中添加以下标志,以允许 LLDB 运行:--cap-add=SYS_PTRACE --security-opt seccomp=unconfined |
Clangd executable | 远程代码模型的远程 Clangd 可执行文件的路径。 |
Paths to mount | 要挂载到容器中的主机目录,如项目目录。 |
Search locations | 自动检测工具包项目的位置。 |
修改入口点
Docker 容器的入口点在容器设置中指定,并在启动容器时作为主进程启动。例如,入口点可以是 shell、SSH 服务器或其他进程。默认情况下,Qt Creator 会在启动容器前修改入口点,以确保主进程是sh
shell。
要阻止Qt Creator 修改入口点,请选择Do not modify entry point 。但是,如果您指定的入口点不是 shell,Qt Creator 就无法启动容器。
指定挂载路径
将项目文件复制到 Docker 容器中,或在Paths to mount 中指定这些文件的路径。共享挂载仅限于主机系统中的位置,这些位置最终可能位于 Docker 容器中的相同绝对位置。在 Windows 中,网络挂载不能用作共享挂载。
Paths to mount 中的路径是一对一映射到 Docker 容器的。选择Insert 浏览要添加的目录。选择Delete Line 删除所选路径,或选择Clear 删除所有路径。
自动检测工具包项目
选择Auto-detect Kit Items 查找工具包项目并为 Docker 设备创建工具包。您可以在设备的 PATH 或指定目录中搜索工具包项。
在Search locations 中,选择 :
- Search in PATH 在 PATH 中查找工具包项。
- Search in Selected Directories 在所选目录中查找工具包项目。
- Search in PATH and Additional Directories 在 PATH 和所选目录中查找工具包项目。
在目录中搜索时,请输入以分号分隔的 Docker 映像目录路径列表,以扫描工具包项。
要列出自动检测到的工具包项,请选择List Auto-Detected Kit Items 。要删除它们,请选择Remove Auto-Detected Kit Items 。
另请参阅 启用和禁用插件、如何:为 Docker 开发,以及如何:管理工具包。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.