Anyone had success with compose-based devcontainers in Qt Creator
-
Recently I tried switching c++-with-cmake-in-docker linux project (on linux host) to the .devcontainer.json development model using Qt Creator.
While the document lacks full examples, I succeded with building the project within Qt Creator with image-based .devcontainer.json like this (only image name and paths changed from my real project)
{ "name": "qtc", "customizations": { "qt-creator": { "auto-detect-kits": false, "kits": [ { "name": "qtckit", "compiler": { "Cxx": "/usr/bin/g++", "C": "/usr/bin/gcc" }, "cmake": { "binary": "/usr/local/bin/cmake", } } ] } }, "image": "ams21/cmake:3.30.6", "workspaceFolder": "/opt" }However, I really want to pass some extra options during container creation, so I tried swithced to compose-based-dontainer, replacinf the image line with 2 new lines
"dockerComposeFile": ["docker-compose.qtc.yaml"], "service": "sigleservice",and, as a starting point create simplest compose file like
services: sigleservice: image: ams21/cmake:3.30.6 command: ["/bin/sh", "-c", "while sleep 1000; do :; done"]And - suddenly Qt creator fails to find cmake inside dev container, reporting "Cannot create cmake tool" error after ending of
[Probe User Environment]. On image-based container it reports the success with CMake like `Found CMake tool: "devcontainer://c41a7ce5fa608110ee3836c3c0d912af49b34347376cbf6fa9b1cb6bd3960d05/usr/local/bin/cmake"In my case it turned out that Qt Creator failed to copy or mount the cmd bridge inside the container. Manualy adding
volumes: - /laptop/opt/qtcreator/libexec/qtcreator/:/devcontainer/libexecin the compose file resolved the issue.
Was I doing something wrong or default settings for dockerComposeFile-based devcontainers are not-ready-for-general-usage yet?