Deploy SpringBoot Apps with IntelliJ’s Docker Plugin: A Step‑by‑Step Guide
Learn how to enable IntelliJ IDEA’s built‑in Docker plugin, configure remote Docker connections, manage images and containers, build custom Docker images from a SpringBoot project, and deploy the application using Docker Compose—all without leaving the IDE.
Plugin Enable
Since the Docker plugin is built into IntelliJ IDEA, simply enable it in the plugin settings.
Configure the remote Docker connection in the Docker settings; a "Connection successful" message confirms correct configuration.
Open the Services panel at the bottom of IDEA, double‑click the Docker icon to connect, and then you can manage remote Docker 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 a container, view details, or delete it.
You can also build a custom image using a Dockerfile. For example, using the mall‑tiny scaffold project:
# Base image
FROM java:8
# Copy JAR into container
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 macrozhengSelect the configured remote Docker service, specify the build directory and image name.
After building, the console shows logs and the JAR is uploaded to the remote server and packaged as an image.
Container Management
Right‑click an image to create a container directly.
Start required services such as MySQL and Redis before running the mall‑tiny project.
Adjust the container configuration to match the original docker run command options.
Refer to the original docker run command to understand each setting:
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-SNAPSHOTView container logs in the Log tab for real‑time monitoring.
Interacting with Containers
Use the container panel to inspect environment variables, port mappings, and IP addresses (via docker inspect).
Execute commands inside the container with docker exec -it.
Docker Compose Support
Create a docker-compose.yml file to define services. Example configuration:
version: '3'
services:
redis:
image: redis:5
container_name: redis-tiny
command: redis-server --appendonly yes
volumes:
- /mydata/redis-tiny/data:/data # data file mount
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/logsClick the docker-compose.yml file arrow to deploy the application to the remote server.
After deployment, access the Swagger UI at http://192.168.3.105:8080/swagger-ui/.
Summary
The IntelliJ IDEA Docker plugin allows you to manage remote Docker images and containers, build custom images, and deploy SpringBoot applications via Docker Compose without using the command line, greatly simplifying the development workflow.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
