Why is Docker support so awful in CLion

已回答

I prefer using CLion over Visual Studio Code but using Docker seems impossible. I am working with someone else and they only have these three lines in a devcontainer.json file for visual studio code and it works flawlessly. How do I replicate this in Clion. I can't even figure out where to start:

{
    "image": "private-registry",
    "extensions": ["ms-vscode.cmake-tools", "ms-vscode.cpptools"],
    "remoteUser": "dev"
}
0

Hello!

In short, you simply need to build the container and then create a Docker toolchain. Here is the detailed instruction - https://www.jetbrains.com/help/clion/clion-toolchains-in-docker.html

0

I have a pre-built image. I would prefer to just pull it from the registry. But I get unsupported registry when I try to add it. It just works on command line docker.

If I do go the toolchain route, what is needed? Do I have to connect ports for SSH, do I have to mount volumes to where my code is? I just want to be able to connect to an existing container and compile

0

>If I do go the toolchain route, what is needed?

You need to select your image. I kindly ask you to read the web help article or to watch the video from it.

0

After realizing you need to add https:// in front of the registry which is not needed on the command line. my main issue now is that the remoteUser feature of visual studio code just seems not possible with CLion

0

Indeed only the local Docker option can be used in CLion as a toolchain. For remote Docker, we recommend using remote with local sources. But in this case the container should be running with an SSH daemon.

0

It seems very hard to work with .devcontainer.json styled containers downloaded from registry in clion? It has been close to 1 year is there a support for this lin clion?

0

Rajesh Mandava07 It's like that across the board with JetBrains right now. I wanted to develop in a remote container for Android with Idea because I prefer the Linux terminal (having used a MacBook for many years now) and I find the whole Gateway setup really janky with numerous Unresponding Host (or whatever the red error is) despite connecting to WSL2 on the local machine.

I just wanted to try something in Goland using a remote container in Docker and 100% agree with you that in VSCode, all you need is to setup `.devcontainer.json` maybe a `docker compose` file if needed and then just a “Rebuild and Reopen in Container” and it works. Files get mounted into the container and I'm done. In fact, in VSCode you don't even have to bring your own docker image, the IDE will happily provide one for you.

In Goland, I'm asked to specify a Git repo to get started and it's unclear from the UI which image the setup intends to use without doing anything else. It really feels like the JetBrains team just doesn't understand the workflow that people want.

0

Rajesh Mandava07, you can open a project that has the .devcontainer folder with the devcontainer.json file in the root inside CLion and start a dev container from the IDE by using Docker. See https://www.jetbrains.com/help/clion/connect-to-devcontainer.html for more details.

Mark, the same is supported in GoLand - https://www.jetbrains.com/help/go/connect-to-devcontainer.html.

0

Anna Falevskaya I just tried it in Goland. Didn't work. It was a very basic hello world project. I launched Goland from inside of Ubuntu on WSL. Then inside Goland, I opened the `devcontainer..json` file as instructed. I clicked on the cube and Goland started building the devcontainer but then failed with this:

[+] Running 1/1
✔ Container devcontainer-vscode-1  S...                                  10.8s 
Cannot find created docker compose devcontainer
 

I closed Goland and launched VSCode the exact same way. VSCode detected the `.devcontainer/devcontainer.json` and immediately offered to re-open the project in a container. I accepted and was up and running within a few seconds. I did not have to specifically open the `devcontainer.json` file in VSCode to make this work.

I could probably get this to work in Goland but IMHO it should just work exactly like it does in VSCode. I think Jetbrains is getting closer with devcontainer support but it still feels cumbersome and is prone to failure.

0

Mark feel free to create an issue in the IntelliJ platform tracker (https://youtrack.jetbrains.com/issues/IDEA) so that my colleagues can assist you.

0

请先登录再写评论。