Skip to content

Docker containers with QtCreator - Ready to develop, build and run Qt Gui applications.

Notifications You must be signed in to change notification settings

arBmind/qtcreator-containers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker images for QtCreator

This project builds Docker images with QtCreator and various compilers used to build and debug C++ and Gui applications using WSL and Docker.

Image (latest versions) Size
Docker Image Version (latest semver) Docker Image Size (latest semver)
Docker Image Version (latest semver) Docker Image Size (latest semver)
Docker Image Version (latest semver) Docker Image Size (latest semver)
Docker Image Version (latest semver) Docker Image Size (latest semver)
Docker Image Version (latest semver) Docker Image Size (latest semver)

Usage

Prerequiste: X server (Linux with X, Win11 or VcXsrv)

To run on Windows 11 you need to mount some special directories to enable fast graphics rendering and X11 communications.

docker run -it \
    --mount src=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind \
    --mount src=/mnt/wslg,target=/mnt/wslg,type=bind \
    -e XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir \
    --mount src="$(pwd)",target=/build,type=bind \
    arbmind/qtcreator-gcc-qt:latest \
    qtcreator myproject.qbs

To use clang instead of gcc use this:

docker run -it \
    --mount src=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind \
    --mount src=/mnt/wslg,target=/mnt/wslg,type=bind \
    -e XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir \
    --mount src="$(pwd)",target=/build,type=bind \
    arbmind/qtcreator-clang-libstdcpp-qt:latest \
    qtcreator myproject.qbs

Description:

  • define the display variable to use Docker
  • mount the current directory to the /build folder
  • use the qtcreator-clang-qt image in the latest variant
  • start the qtcreator with myproject.qbs

If you want to do more work on the project, we recommend to use a docker-compose.

version: "3.7"

volumes:
  tmp: # cached builds

services:
  myproject:
    image: arbmind/qtcreator-gcc-qt:latest
    cap_add: [SYS_PTRACE] # needed for lldb debugging
    security_opt: [seccomp=unconfined] # needed for lldb debugging
    environment:
      - XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir
    command: qtcreator myproject.qbs
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix
      - /mnt/wslg:/mnt/wslg
      - ./repository/:/build
      - tmp:/tmp

Details

The Dockerfile is multi staged and has different targets for all the variants. All targets with underscores are meant to be internally only.

Note: The Clang Qt combination is missing because the Qt Company does not publish binaries built for libc++

QtCreator is preconfigured to run Gui applications properly.

To support your development the user is non-root. You may still install extra software with sudo if you need.

About

Docker containers with QtCreator - Ready to develop, build and run Qt Gui applications.

Topics

Resources

Stars

Watchers

Forks

Packages