More control over Dev containers

Hi,

I am trying to get the develop containers to work with Pycharm. I have a working  file where I build through a docker-compose and dockerfile. This approach works just fine with the devcontainers cli to get a container up and running. In which case I would for instance be able to connect to it with VS Code. 

Pycharm on the other hand does not allow to connect to a running container. But I also didn't find a way to build a container only with the devcontainer.json. Either I have to clone from git, which I would rather do in the docker file as it gives me more control. Or I have to build one which mounts the current directory into the container. Which is also an option I don't want to use.

My most preferred solution would be to attach to an existing dev container, as this decouples the container from the IDE. Otherwise I would like a very simple option to just execute the devcontainers.json without any other fluff like the pycharm managed cloning of the repo.

My current workaround solution would be to install ssh inside of the container and connect through that, which feels like it is more complex than it should be.

Best regards 

Leonard

0
Hi,

Thanks for reaching out! At the moment, PyCharm can only use Dev Containers that it builds itself from devcontainer.json. As part of that process it also installs a JetBrains backend into the container, which is why it can’t just attach to an already running dev container built by the devcontainer CLI or plain docker-compose.
Because of this, your two practical options today are:

• Use Dev Containers from PyCharm with Create Dev Container and Mount Sources, so PyCharm reuses your local checkout and doesn’t re‑clone the repo, but still manages the container and backend itself.
• Keep doing what you’re experimenting with now: run your containers yourself, install SSH inside, and connect via Remote Development over SSH as if the container were just a generic remote host.

The “attach to an existing Dev Container” experience you’re asking for is tracked in our issue tracker: https://youtrack.jetbrains.com/projects/IJPL/issues/IJPL-172884 

You can upvote it and star it to track any updates.

Best regards,
Uros Glogovac
IntelliJ Support
0

请先登录再写评论。