Skip to content

Commit 171ee97

Browse files
authored
Update README.MD
1 parent 01a592a commit 171ee97

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

README.MD

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This repository contains methods to Dockerize Java Projects.
4141
- docker push rahulvaish/springbootdocker
4242
<img width="810" alt="image" src="https://user-images.githubusercontent.com/689226/210193571-6b418088-5b9c-44ca-962d-369d2b3adf85.png">
4343

44-
44+
<hr>
4545

4646

4747
- ###### [SpringBoot Inter Container Communication](https://github.com/rahulvaish/Docker-Java/tree/SpringBootContainerIO)
@@ -51,26 +51,25 @@ This repository contains methods to Dockerize Java Projects.
5151
- Test the service: **CalculatorServiceClient** container inteacts with **CalculatorService** container. </br>
5252
![image](https://user-images.githubusercontent.com/689226/66031356-d82c3200-e520-11e9-9892-3e5cb5456b11.png)
5353

54-
54+
<hr>
55+
5556
- ###### [SpringBoot-MySQL Container Communication](https://github.com/rahulvaish/Docker-Java/tree/SpringBootMySQL)
5657
###### This example illustrates how SpringBoot Docker container communicates with MySQL container. [[Source Code]](https://github.com/rahulvaish/Docker-Java/tree/SpringBootMySQL)
58+
- Create a private network
59+
![image](https://user-images.githubusercontent.com/689226/210200502-13125f24-77f8-4597-88cb-1215c4e16e76.png)
5760
- Start the MySQL container: </br>
58-
```
59-
docker run --name mysqlcontainer -d -p 3306:3306 -e MYSQL_DATABASE=dev -e MYSQL_ROOT_PASSWORD=root mysql
60-
```
61+
```
62+
docker container run --network springbootmysqlntw --name mysqlcontainer -d -p 3306:3306 -e MYSQL_DATABASE=mysqldb -e MYSQL_ROOT_PASSWORD=root mysql
63+
```
6164
- Create Table & Insert some Data: </br>
62-
![image](https://user-images.githubusercontent.com/689226/66045139-b8a50180-e540-11e9-964a-08e07d555c77.png)
63-
64-
- **Build** & **Run** SpringBoot Image: </br>
65-
```
66-
docker build -f Dockerfile -t springbootdockermysqldocker .
67-
68-
docker run -p 9070:9070 springbootdockermysqldocker
69-
70-
FYI: On MAC, docker run -p 9070:9070 --link mysqlcontainer:mysqlcontainer springbootdockermysqldocker
71-
```
72-
- Test the service: </br>
73-
![image](https://user-images.githubusercontent.com/689226/66045691-daeb4f00-e541-11e9-8d6d-c797604fa387.png)
65+
<img width="1160" alt="image" src="https://user-images.githubusercontent.com/689226/210198420-c762e7af-7bda-4621-8ee8-0bc7a6fafc6a.png">
66+
- Build & Start SpringBoot Application (on same private network)
67+
<b>NOTE:</b> We are not hardcoding DB's IP. Instead using container's name.
68+
![image](https://user-images.githubusercontent.com/689226/210200459-d2bba194-d5f3-496b-a0cb-0bb4616e8559.png)
69+
<img width="1691" alt="image" src="https://user-images.githubusercontent.com/689226/210200719-fccf68c6-0388-4ddc-929d-cea1a80b2987.png">
70+
<img width="750" alt="image" src="https://user-images.githubusercontent.com/689226/210200787-e50b31c0-a789-4983-9f6d-231c956b8f3d.png">
71+
72+
<hr>
7473
7574
7675

0 commit comments

Comments
 (0)