Devcontainer: Custom toolchain is forgotten on restart

Answered

I have a devcontainer defined by a devcontainer.json file. 

I open the project.  I'm prompted to re-open in the container. I do. I create a cmake profile called “Debug-Icecream”. When I go to manage toolchains, I create a custom toolchain called “Icecream” pointing to my compiler (non-standard path).  I can succesfuly build my project. 

 

However, the next time I open the project and then re-open in container, my custom toolchain appears to be gone.  In the cmake window I see “Toolchain ‘Icecream’ not found”. 
 

I've also tried creating the Icecream toolchain before re-opening in container, but I get the same results. 

I can go to “Configure” and re-create it, but of course, I'd prefer not to have to re-define my toolchain every time I open/close CLion.  What's the preferred way to keep the toolchain defined between clion/container restarts?

0
4 comments

Hello, Benjaminaaronblumer

Please note that the Reopen in Container action creates a new container each time - that's why your settings are lost. I'd recommend you open the already created dev container from the File | Remote Development… window or Remote Development | Dev Containers node in the Welcome screen:

 

0

Thanks for this – that makes sense. 

Though, every once in a while, the docker container will go down / be shut down.  Is there another way to save these settings? Perhaps by mounting a config file somewhere?

0

Could you please try to copy from the current container and add the /.jbdevcontainer/config/JetBrains/Clion<version>/options/linux/toolchains.xml file into the dev container setup, for example, by moving it to the image via the Dockerfile? 
 

0

Thanks for the tip, Olga! So far, seems like it's working.

For future others to repro:

1) Load .devcontainer.json container.

2) Copy /.jbdevcontainer/config/JetBrains/CLion2025.1/options/ to host via a mount.

3) Stop remote dev container. Kill docker containers.

4) modify devcontainer.json to include a mount to the options dir:

 "mounts": ["source=/path/on/host/clion_opts,target=/.jbdevcontainer/config/JetBrains/CLion2025.1/options,type=bind,consistency=cached"],

5) Startup devcontainer from .devcontainer.json.

6) Create custom toolchain.

7) `cat /.jbdevcontainer/config/JetBrains/Clion<version>/options/linux/toolchains.xml` see the changes. 

8) kill docker container / devcontainer

9) Restart from the .devcontainer.json

10) Toolchain preserved!

0

Please sign in to leave a comment.