添加 Docker 设备

Docker 映像中创建 Docker 设备,并用它们来构建、运行和调试应用程序。Docker 容器的运行方式与虚拟机类似,但使用的系统资源较少,但灵活性较低。

原则上支持 Linux、macOS 和 Windows 主机,但推荐使用 Linux 平台。

要在 Docker 设备上构建、运行和调试应用程序,请在开发主机上安装和配置docker-cliQt Creator 会自动检测 Docker 容器中的构建和运行工具包项目(如调试器Qt 版本),并为设备创建工具包。

建议使用 CMake 在 Docker 容器中构建应用程序。

注意: 启用 Docker 插件才能使用它。

要从 Docker hub 或其他注册中心提取映像,请使用docker pull命令。

将 Docker 镜像添加为设备

将 Docker 映像添加为设备:

  1. 转到首选项>Devices >Docker
  2. Command 中,输入 Docker CLI 的路径。

    设备偏好设置中的 Docker 选项卡

  3. 转到Devices
  4. 选择Add >Docker Device >Start Wizard 以搜索本地 Docker 安装中的映像。
  5. 选择一个 Docker 映像,然后选择OK
  6. Devices 中,检查并更改 Docker 设备首选项。

    设备偏好设置 "设备 "选项卡中的 Docker 设备

  7. 选择Apply 保存更改。

选择 Docker 映像

Docker Image Selection 对话框会显示本地 Docker 安装中的 Docker 映像列表。您可以根据版本库名称或标记或图像 ID 或大小对图像进行排序。

Docker 映像选择对话框

选择Show unnamed images 可显示未标记的图像。

双击图像以选中该图像。

编辑 Docker 设备套件

转到首选项>Kits ,检查自动生成的工具包是否指向适当的工具包项目。

另请参阅 启用和禁用插件如何:为 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.