Adding Docker Devices
Create Docker devices from Docker images and use them to build, run, and debug applications. A Docker container operates like a virtual machine but uses less system resources at the cost of being less flexible.
While Linux, macOS, and Windows hosts are supported in principle, Linux is the recommended platform.
To build, run, and debug applications on Docker devices, you must install and configure
docker-cli on the development host. Qt Creator automatically detects build and run kit items, such debuggers and Qt versions, in the Docker container and creates kits for the devices.
You can use CMake or qmake to build applications in the Docker container.
To pull images from Docker hub or other registries, use the docker pull command.
To add a Docker image as a device:
- Select Edit > Preferences > Devices > Docker and enter the path to the Docker CLI in the Command field.
- Select Devices > Add > Docker Device > Start Wizard to search for images in your local Docker installation.
- Select the Docker image to use, and then select OK.
- In Devices, check and change Docker device preferences.
- Select Apply to save your changes.
The following table summarizes the options you can set.
|Run as outside user||On Linux and macOS, sets the user ID and group ID of the user running Qt Creator in the Docker container. This option is not available on Windows.|
|Do not modify entry point||Stops Qt Creator from modifying the entry point of the image. Make sure that the entry point starts a shell.|
|Enable flags needed for LLDB||Adds the following flags to the container to allow LLDB to run:|
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined
|Clangd executable||The path to a remote Clangd executable to use for a remote code model.|
|Paths to mount||Host directories to mount into the container, such as the project directory.|
|Search locations||Where to automatically detect kit items.|
The following sections describe the Docker device preferences in more detail.
The Docker Image Selection dialog displays a list of Docker images in your local Docker installation. You can sort the images according to the repository name or tag or the image ID or size.
Select Show unnamed images to show images that are not tagged.
Double-click an image to select it.
The entry point of a Docker container is specified in the container settings and started as the main process when starting the container. The entry point can be a shell, an SSH server, or another process, for example. By default, Qt Creator modifies the entry point before it starts a container to make sure that the main process is an
To stop Qt Creator from modifying the entry point, select Do not modify entry point. However, if the entry point you specify is not a shell, Qt Creator cannot start the container.
You can either copy your project files into the Docker container or specify paths to them in Paths to mount. Shared mounts are restricted to locations in the host system that can end up in the same absolute location in the Docker container. On Windows, network mounts cannot be used as shared mounts.
The paths in Paths to mount are mapped one-to-one to the Docker container. Select Insert to browse directories to add. Select Delete Line to delete the selected path or Clear to delete all paths.
Select Auto-detect Kit Items to find kit items and create kits for the Docker device. You can search for kit items in the device's PATH or in the specified directories.
In Search locations, select:
- Search in PATH to find kit items in PATH.
- Search in Selected Directories to find kit items in the selected directories.
- Search in PATH and Additional Directories to find kit items in the PATH and in the selected directories.
When searching in directories, enter a semicolon-separated list of directory paths in the Docker image to scan for kit entries.
To list the automatically detected kit items, select List Auto-Detected Kit Items. To remove them, select Remove Auto-Detected Kit Items.
Select Edit > Preferences > Kits to check that the automatically generated kits point to the appropriate kit items.
To specify build settings:
- Open a project for an application you want to develop for the device.
- Select Projects > Build & Run to enable the kit that you specified above.
Select Run to specify run settings. Usually, you can use the default settings.
© 2023 The Qt Company Ltd. 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.