← Back to DevBytes

IntelliJ IDEA Docker Integration: Complete Guide

What is IntelliJ IDEA Docker Integration?

IntelliJ IDEA Docker integration is a built‑in feature that connects your IDE directly to a Docker daemon, enabling you to manage containers, images, networks, and volumes without leaving the editor. It turns Docker into a seamless part of your development workflow by providing visual editors, code completion, run/debug configurations, and remote container access—all within the same tool you use for coding.

Why It Matters

🚀 Deploy your AI agent in 10 minutes

Managed Hermes hosting. Zero DevOps. 100M tokens/mo included.

Try it free →

Modern applications rely heavily on containerization for consistent development, testing, and deployment environments. The integration eliminates context switching between the IDE and the terminal or a separate Docker GUI. You gain:

How to Use It

Below you’ll find a step‑by‑step walkthrough covering setup, Dockerfile editing, run configurations, Docker Compose, debugging, and container management.

Prerequisites

Configuring Docker Connection

Open Settings (Ctrl+Alt+S) → Build, Execution, Deployment > Docker. Click the + button to add a new Docker configuration. Choose the connection type:

Once added, IntelliJ verifies the connection and displays the Docker tool window (View > Tool Windows > Docker). You’ll see all images, containers, volumes, and networks.

Working with Dockerfiles

Create a new file named Dockerfile in your project. IntelliJ provides full language support: syntax highlighting, inspections, and Ctrl+Space completion for Docker instructions. For example:

FROM eclipse-temurin:17-jre-alpine
LABEL maintainer="team@example.com"
COPY target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app.jar"]

You can use the Run gutter icon next to FROM to build the image and run a container immediately. Right‑click inside the file and select Create Dockerfile Run Configuration to save a reusable configuration.

Running Containers via Run Configurations

IntelliJ allows you to define Docker run configurations that build an image, create a container, and optionally start it. This is similar to a regular application run configuration but operates entirely through Docker.

To create one:

Example configuration for a Spring Boot application:

# Run Configuration settings (visual editor fields):
Name: WebApp Docker
Dockerfile: ./Dockerfile
Image tag: myapp:latest
Container:
  Ports: 8080:8080
  Environment variables: SPRING_PROFILES_ACTIVE=docker
  Volume mounts: ./logs:/app/logs

Now you can run and stop this configuration like any other—Shift+F10 (or ⌃R on macOS) to run, Shift+F9 to debug.

Using Docker Compose

For multi‑container applications, IntelliJ reads docker-compose.yml files natively. Place a Compose file in the project root and the IDE will display a Docker Compose section in the Docker tool window. You can:

Sample docker-compose.yml:

version: '3.8'
services:
  api:
    build: .
    ports:
      - "8080:8080"
    environment:
      DB_URL: jdbc:postgresql://db:5432/appdb
    depends_on:
      db:
        condition: service_healthy
  db:
    image: postgres:15-alpine
    environment:
      POSTGRES_USER: appuser
      POSTGRES_PASSWORD: secret
      POSTGRES_DB: appdb
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U appuser -d appdb"]
      interval: 5s
      timeout: 5s
      retries: 5

volumes:
  pgdata:

To run, open the Services tool window (usually nested in Docker), select the Compose project, and press the play button. IntelliJ automatically builds images that need building, brings up the stack, and shows container status.

Debugging Applications Inside Containers

Debugging a containerized Java application works transparently with the Docker run configuration. When you use Run > Debug (Shift+F9), IntelliJ performs these steps automatically:

There’s no need to manually add -agentlib:jdwp arguments—the integration handles it. However, if you’re using a custom entrypoint, you can pass the agent options explicitly:

ENTRYPOINT ["java", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005", "-jar", "/app.jar"]

Then set the container’s port mapping to include 5005:5005. In the run configuration, under ContainerDebug, specify the debug port. IntelliJ will attach automatically when you choose Debug.

Remote Debugging of Already Running Containers

Sometimes you need to debug a container that was started outside IntelliJ (e.g., via docker‑compose from the terminal). In the Docker tool window, right‑click on any running container and choose Attach Debugger. IntelliJ will scan for Java debug ports and propose a connection. You can also manually specify the host and port if the container exposes a JDWP port.

Container Management

The Docker tool window provides full lifecycle management:

You can also drag‑and‑drop a running container’s log into the editor for analysis, or use the integrated terminal to execute shell commands inside the container.

Best Practices

Conclusion

IntelliJ IDEA Docker integration transforms containerized development from a separate command‑line chore into an integral part of the coding experience. By centralizing Docker operations inside the IDE, it accelerates the edit‑build‑debug cycle, simplifies multi‑service orchestration, and makes debugging containers feel native. Whether you’re building microservices, deploying a database‑backed web app, or experimenting with new technologies, the Docker integration reduces friction and helps you stay in flow. Start by connecting your Docker daemon, authoring a Dockerfile, and creating your first run configuration—you’ll quickly see how much smoother container development can be.

🚀 Need a reliable AI agent for your project?

Deploy Hermes Agent in 10 minutes. Managed hosting, zero DevOps.

Get Started — $23.99/mo
← Back to all articles