Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Intellij be used with a Visual-Studio-Code style docker devcontainer?

I've been using devcontainers in Node development in VSC and enjoy the idea that I can commit a shared configuration to ensure everyone on the team has the same runtime/buildtime. I've been looking for a similar way to configure IntelliJ, but am having some difficulties determining if this is even possible.

I am running IntelliJ 2020.2 and have the Node Remote Interpreter plugin installed.

In my devcontainer, I map a Docker volume node_modules to my workspace such that all my different containers can share the same volume, and not need to re-download the set of npm modules everytime.

I have setup & created an appropriate Run/Debug Docker configuration, and when I launch it, the container is built & configured properly. However, in IntelliJ, understandably, the node_modules folder still remains blank (as that folder is only mounted in the remote container).

Similarly, I have setup a remote Node run configuration pointing to my docker image, but similarly, IntelliJ does not see any libraries that are supposed to be in the node_modules folder.

Is there any way to work with this kind of configuration in IntelliJ such that the IDE understands the mappings I create in my Docker container?

like image 716
Eric B. Avatar asked Oct 13 '20 17:10

Eric B.


People also ask

Can I run IntelliJ in Docker container?

IntelliJ IDEA provides Docker support using the Docker plugin. The plugin is bundled and enabled by defaultin IntelliJ IDEA Ultimate Edition. For IntelliJ IDEA Community Edition, you need to install the Docker plugin as described in Install plugins.

How do I create a Docker image in IntelliJ?

Run the Java application in a Docker container In the Project tool window, right-click the project name, point to New and click File. In the New File dialog, type Dockerfile and press Enter . This Dockerfile builds an image based on the openjdk:17 image from Docker Hub.

Can I run Visual Studio in a Docker container?

Visual Studio provides a consistent way to develop Docker containers and validate your application locally. You can run and debug your apps in Linux or Windows containers running on your local Windows desktop with Docker installed, and you don't have to restart the container each time you make a code change.

What is Docker in IntelliJ?

Last modified: 13 May 2021 Docker enables developers to deploy applications inside containers for testing code in an environment identical to production. IntelliJ IDEA provides Docker support using the Docker plugin. The plugin is bundled and enabled by default in IntelliJ IDEA Ultimate Edition.

How to run Visual Studio Code in a docker container?

This allows us to run Visual Studio Code in a container. In the root directory of your project, you need to create a folder called .devcontainer. This is where we will store the settings for our environment. Then create two files in this folder, devcontainer.json and a Dockerfile.

What is a devcontainer in Visual Studio Code?

A devcontainer.json file in your project tells VS Code how to access (or create) a development container with a well-defined tool and runtime stack. This container can be used to run an application or to sandbox tools, libraries, or runtimes needed for working with a codebase.

Why can’t I install the Docker extension in a container?

While the Docker extension can run both remotely and locally, if it is already installed locally, you will be unable to install in a container without first uninstalling it locally. We will address this problem in a future VS Code release. Many extensions will work inside dev containers without modification.


2 Answers

no, there is no such feature in IDEA. Please vote for IDEA-202267 to be notified on any progress with this feature request

like image 106
lena Avatar answered Oct 27 '22 03:10

lena


JetBrains now supports GitPod as a first class citizen implementation for the Development Containers concept. Both IntelliJ Idea and the next-gen IDE Fleet are supported. Also JetBrains Space would be an option, if you have licences for it in your company. There's a landing page that present all the options:

enter image description here

In contrast to the VSCode style implementation of the concept where you configure your Dev Containers using a devcontainer.json with GitPod you use a .gitpod.yml. But GitPod is already working actively on supporting the devcontainer.json format, which was Open Sourced by Microsoft here.

More details and in-depth review of the Development Containers concept can be found in this post.

like image 43
jonashackt Avatar answered Oct 27 '22 04:10

jonashackt