This repository contains methods to Dockerize Java Projects.
- Dockerizing HelloWorld Java Application
- Dockerizing SpringBoot Application
- SpringBoot Inter Container Communication
- SpringBoot-MySQL Container Communication
- SpringBoot-DockerCompose
- SpringBoot-DockerVolume
-
This example illustrates how to Dockerize a simple Java Project. [Source Code]
-
This example illustrates how to Dockerize a SpringBoot Project. [Source Code]
-
This example illustrates how SpringBoot Docker containers communicate. [Source Code]
-
This example illustrates how SpringBoot Docker container communicates with MySQL container. [Source Code]
- Create a private network
- Start the MySQL container:
docker container run --network springbootmysqlntw --name mysqlcontainer -d -p 3306:3306 -e MYSQL_DATABASE=mysqldb -e MYSQL_ROOT_PASSWORD=root mysql
- Create Table & Insert some Data:
- Build & Start SpringBoot Application (on same private network) NOTE: We are not hardcoding DB's IP. Instead using container's name.
-
This example illustrates how Docker Compose works with two springBoot Projects.Here, CalculatorService is Producer and CalculatorServiceClient is Consumer [Source Code]