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 |
|---|---|
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 WAYLAND_DISPLAY=wayland-0 \
-e XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir \
--mount src="$(pwd)",target=/build,type=bind \
arbmind/qtcreator-gcc-qt:latest \
qtcreator myproject.qbsTo 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 WAYLAND_DISPLAY=wayland-0 \
-e XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir \
--mount src="$(pwd)",target=/build,type=bind \
arbmind/qtcreator-clang-libstdcpp-qt:latest \
qtcreator myproject.qbsDescription:
- define the display variable to use Docker
- mount the current directory to the
/buildfolder - use the
qtcreator-clang-qtimage 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:
- WAYLAND_DISPLAY=wayland-0
- 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:/tmpThe 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.