Use Development Containers | Qt Creator Documentation

- Qt Creator Documentation
- Use Development Containers
- Qt Creator 19.0.0

Set preferences for Docker devices ◦ Developing for iOS

# Use Development Containers

Use Development Containers (dev container) to define and configure a consistent development environment for your project across developers and automated build or test systems.

You can run dev containers either locally or remotely in a cloud for running applications, for separating tools, libraries, or runtimes that you need when working with a codebase, or for continuous integration and testing.

A dev container environment can differ from the deployment environment as they typically include tools and utilities needed during development that are not required for final deployment.

For the full specification and the `devcontainer.json` file format, see the Development Container documentation.

Note: Enable the Development Container Support plugin to use it.

## Configure dev containers

To configure a dev container for Qt Creator:

1. Create a `devcontainer.json` file in your project directory.
2. Add a `qt-creator` section under `customizations` in the `devcontainer.json` file.
3. Use the customization options described in this topic to customize the dev container.

## Customization options for dev containers

The following table shows the available options for customizing Qt Creator in the `devcontainer.json` file.

Property | Type | Description
--- | --- | ---
`auto-detect-kits` | `boolean` | Set to `true` to try to automatically detect a kit in the dev container.
`run-processes-in-terminal` | `boolean` | Set to `true` to run some of the dev container setup processes in a terminal window. Currently only used for `docker build`.
`copy-cmd-bridge` | `boolean` | Set to `true` to copy the Command Bridge Helper, a service for communicating with remote devices, into the dev container instead of trying to mount it. This is useful if the dev container is not able to mount the host filesystem.
`mount-libexec` | `boolean` | Set to `true` to mount the `libexec` directory into the dev container. This is used for the Command Bridge Helper.
`libexec-mount-point` | `string` | Specify the mount point for the `libexec` directory in the dev container. This is used for the Command Bridge Helper.
`kits` | an array of objects | Specify the custom kits to be used in the dev container.

### Configuration for typical local development

The following example `devcontainer.json` file shows how to configure the dev container for a typical local development workflow. It enables automatic detection of kits, mounts the `libexec` directory into the container, and specifies the mount point.

This setup is useful when you want Qt Creator to automatically find available build kits and ensure that required helper tools from the `libexec` directory are accessible inside the container.

     {
         "customizations": {
             "qt-creator": {
                 "device": {
                     "auto-detect-kits": true,
                     "run-processes-in-terminal": false,
                     "copy-cmd-bridge": false,
                     "mount-libexec": true,
                     "libexec-mount-point": "/devcontainer/libexec"
                 }
             }
         }
     }

### Configuration for custom kits and toolchains

The following example `devcontainer.json` file demonstrates how to configure a dev container when you need to use a specific Qt version, compiler, or toolchain inside the container. This is useful for cross-compilation, supporting multiple build configurations, or ensuring a consistent development environment across teams.

This configuration file disables automatic kit detection and instead defines a custom kit using the `kits` property. The kit specifies the Qt version, compiler paths, CMake binary and generator, and debugger to be used by Qt Creator within the dev container.

     {
         "customizations": {
             "qt-creator": {
                 "auto-detect-kits": false,
                 "kits": [
                     {
                         "name": "My DevContainer Kit",
                         "qt": "/6.7.0/gcc_64/bin/qmake6",
                         "compiler": {
                             "Cxx": "/usr/bin/c++",
                             "C": "/usr/bin/gcc"
                         },
                         "cmake": {
                             "binary": "/usr/bin/cmake",
                             "generator": "Unix Makefiles"
                         },
                         "debugger": "/usr/bin/lldb"
                     }
                 ]
             }
         }
     }

See also Enable and disable plugins and How to: Develop for Docker.

Set preferences for Docker devices ◦ Developing for iOS