Cloud Native 8 min read

Deploy SpringBoot Apps with IntelliJ IDEA’s Docker Plugin – Step‑by‑Step Guide

Learn how to enable IntelliJ IDEA’s built‑in Docker plugin, configure remote Docker connections, manage images and containers, build Dockerfiles for a SpringBoot project, and deploy the application using Docker Compose, all without leaving the IDE.

macrozheng
macrozheng
macrozheng
Deploy SpringBoot Apps with IntelliJ IDEA’s Docker Plugin – Step‑by‑Step Guide

Plugin Activation

Enable the built‑in Docker plugin in IntelliJ IDEA settings.

Configure remote Docker connection information in the Docker settings; a "Connection successful" message confirms correct setup.

Open the Services panel, double‑click the Docker icon to connect and manage remote containers and images.

Image Management

Click the Images button, enter the image name and tag to download; IDEA provides auto‑completion.

Right‑click an image to create containers, view details, or delete it.

Use a Dockerfile to build a custom image, e.g., for the mall‑tiny project:

# Base image
FROM java:8
# Add the JAR file
ADD ./mall-tiny-1.0.0-SNAPSHOT.jar /mall-tiny-1.0.0-SNAPSHOT.jar
# Expose port 8080
EXPOSE 8080
# Run the JAR
ENTRYPOINT ["java", "-jar", "/mall-tiny-1.0.0-SNAPSHOT.jar"]
MAINTAINER macrozheng

Container Management

Right‑click an image to create a container directly.

Start required services such as MySQL and Redis before launching the application.

Adjust container configuration to match the original docker run command options.

docker run -p 8080:8080 --name mall-tiny \
  --link mysql:db \
  --link redis:redis \
  -e 'spring.profiles.active'=prod \
  -v /etc/localtime:/etc/localtime \
  -v /mydata/app/mall-tiny/logs:/var/logs \
  -d mall-tiny/mall-tiny:1.0.0-SNAPSHOT

View container logs in the Log tab and inspect environment variables, port mappings, or container IP via the IDE.

Execute commands inside the container using docker exec -it from the IDE.

Docker Compose Support

Create a docker-compose.yml file to define services; for example:

version: '3'
services:
  redis:
    image: redis:5
    container_name: redis-tiny
    command: redis-server --appendonly yes
    volumes:
      - /mydata/redis-tiny/data:/data
    ports:
      - 6379:6379
  mall-tiny:
    image: mall-tiny/mall-tiny:1.0.0-SNAPSHOT
    container_name: mall-tiny
    links:
      - redis:redis
    depends_on:
      - redis
    ports:
      - 8080:8080
    environment:
      - 'spring.profiles.active=prod'
      - 'spring.datasource.url=jdbc:mysql://192.168.3.105:3306/mall_tiny?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false'
      - 'spring.redis.host=redis'
    volumes:
      - /etc/localtime:/etc/localtime
      - /mydata/app/mall-tiny/logs:/var/logs

Click the docker-compose.yml file in the IDE to deploy the application to the remote server.

After deployment, access the Swagger UI at http://<remote‑host>:8080/swagger-ui/.

Conclusion

IntelliJ IDEA’s official Docker plugin enables remote Docker image and container management, as well as Docker Compose deployment, without using the command line, making SpringBoot application packaging, deployment, and execution much more convenient.

References

Official documentation: https://www.jetbrains.com/help/idea/docker.html

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockercontainerizationSpringBootIntelliJ IDEADocker ComposeRemote Deployment
macrozheng
Written by

macrozheng

Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.