File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,3 +181,33 @@ Stop the services as:
181181
182182https://github.com/arun-gupta/docker-java/issues/51
183183
184+ ### Use multi-host networking
185+
186+ Start a Java EE application with WildFly and MySQL containers.
187+
188+ . Create a new directory and name it `wildfly-mysql-javaee7`.
189+ . Create a new file `docker-compose.yml` and copy the contents from the following:
190+ +
191+ [source, yaml]
192+ ----
193+ mysqldb:
194+ container_name: "db"
195+ image: mysql:latest
196+ environment:
197+ MYSQL_DATABASE: sample
198+ MYSQL_USER: mysql
199+ MYSQL_PASSWORD: mysql
200+ MYSQL_ROOT_PASSWORD: supersecret
201+ mywildfly:
202+ image: arungupta/wildfly-mysql-javaee7
203+ environment:
204+ - MYSQL_URI=db:3306
205+ ports:
206+ - 8080:8080
207+ ----
208+ +
209+ . Run the application as:
210+ +
211+ `docker-compose --x-networking up -d`
212+ +
213+ `--x-networking` will create a bridge network. Docker 1.9 is required to run this application.
Original file line number Diff line number Diff line change @@ -531,6 +531,7 @@ <h1>Docker and Kubernetes for Java Developers</h1>
531531< li > < a href ="#_stop_services "> Stop Services</ a > </ li >
532532< li > < a href ="#_remove_containers "> Remove Containers</ a > </ li >
533533< li > < a href ="#_scale_services "> Scale Services</ a > </ li >
534+ < li > < a href ="#_use_multi_host_networking "> Use multi-host networking</ a > </ li >
534535</ ul >
535536</ li >
536537< li > < a href ="#Docker_Swarm "> Deploy Application on Docker Swarm Cluster</ a >
@@ -3385,6 +3386,49 @@ <h3 id="_scale_services">Scale Services</h3>
33853386< p > < a href ="https://github.com/arun-gupta/docker-java/issues/51 " class ="bare "> https://github.com/arun-gupta/docker-java/issues/51</ a > </ p >
33863387</ div >
33873388</ div >
3389+ < div class ="sect2 ">
3390+ < h3 id ="_use_multi_host_networking "> Use multi-host networking</ h3 >
3391+ < div class ="paragraph ">
3392+ < p > Start a Java EE application with WildFly and MySQL containers.</ p >
3393+ </ div >
3394+ < div class ="olist arabic ">
3395+ < ol class ="arabic ">
3396+ < li >
3397+ < p > Create a new directory and name it < code > wildfly-mysql-javaee7</ code > .</ p >
3398+ </ li >
3399+ < li >
3400+ < p > Create a new file < code > docker-compose.yml</ code > and copy the contents from the following:</ p >
3401+ < div class ="listingblock ">
3402+ < div class ="content ">
3403+ < pre class ="highlight "> < code class ="language-yaml " data-lang ="yaml "> mysqldb:
3404+ container_name: "db"
3405+ image: mysql:latest
3406+ environment:
3407+ MYSQL_DATABASE: sample
3408+ MYSQL_USER: mysql
3409+ MYSQL_PASSWORD: mysql
3410+ MYSQL_ROOT_PASSWORD: supersecret
3411+ mywildfly:
3412+ image: arungupta/wildfly-mysql-javaee7
3413+ environment:
3414+ - MYSQL_URI=db:3306
3415+ ports:
3416+ - 8080:8080</ code > </ pre >
3417+ </ div >
3418+ </ div >
3419+ </ li >
3420+ < li >
3421+ < p > Run the application as:</ p >
3422+ < div class ="paragraph ">
3423+ < p > < code > docker-compose --x-networking up -d</ code > </ p >
3424+ </ div >
3425+ < div class ="paragraph ">
3426+ < p > < code > --x-networking</ code > will create a bridge network. Docker 1.9 is required to run this application.</ p >
3427+ </ div >
3428+ </ li >
3429+ </ ol >
3430+ </ div >
3431+ </ div >
33883432</ div >
33893433</ div >
33903434< div class ="sect1 ">
You can’t perform that action at this time.
0 commit comments