DEV Community

Darius
Darius

Posted on

IntelliJ Docker plugin

TIL that IntelliJ has a Docker plugin that gives you a UI tool within the IDE to integrate with Docker (running on your local machine). Not much different from integration with other servers like WebSphere, Tomcat and so on.

Step 1: install the Plugin
Docker Plugin

Basic set-up is easy. Just point to Docker.
Plugin setup

Step 2: Map Ports etc.
Clicking on the same two arrows, but then selecting the "Edit Dockerfile" option Docker parmsallows you to map ports and to specify other options you might otherwise need to provide at the Docker command line.

Step 3: Run your Dockerfile
Once this is done, when you open your Dockerfile, you will see the typical green "Run" arrowheads in IntelliJ (or whatever shows in your theme).
Run

Step 4: Monitor and Control
The "Services" tool tab allows you to monitor the container's logs, and to control various other aspects... check out the various tabs.Services tab. For instance, you can look at the environment variables.
It also has an option to run a docker exec exec So, it's easy to jump into a shell in your container to check it out.

Top comments (3)

Collapse
 
jef profile image
Jef LeCompte

I always install this plugin, but never really use it. Is there anything have you've found that has saved you time or benefitted you rather than running in terminal?

Collapse
 
dariusx profile image
Darius • Edited

That is a good question, and I suspect that the answer is philosophical :)

Most of these integrations are a matter of taste. For instance, I usually start my local Tomcat and Liberty from the command line, and have the logs streaming in to Notepad++.

But, I think that's just a bad habit on my part... When these types of integrations work well, they actually do save a second or two... adding up to many seconds, but actually a smoother, integrated experience.

Sometimes these types of integrations require some specific set-up that is not normal, or have some idiosyncrasy...but, I don't see any here.

I think it is also a matter of taste... the debate between IDE vs. command line... has deeper psychological roots... loss of control, less knowledge of commands ending up dumbing down developers and hiding the underlying 'model" of whatever it is they are integrating with.

Collapse
 
jef profile image
Jef LeCompte

Makes sense. I have no problem using a tool or the CLI if it makes more sense visually/functionally. Seems like it would be cool to store a few different environments within Jetbrains to configure different scenarios.