- Building Web Apps with Spring 5 and Angular
- Ajitesh Shukla
- 177字
- 2021-07-02 19:38:28
Docker compose script to set up the development environment
Now that we have set up both Tomcat and MySQL as individual containers, let's create a Docker compose script using which both the containers can be started simultaneously, thereby, starting the Dev environment.
- Save the following source code as docker-compose.yml in the same folder as the aforementioned files:
version: '2' services: web: build: context: . dockerfile: tomcat.df ports: - "8080:8080" volumes: - .:/mnt/ links: - db db: image: mysql:5.7 ports: - "3326:3306" environment: - MYSQL_ROOT_PASSWORD=r00t
- Execute the following command to start and stop the services:
// For starting the services in the foreground docker-compose up // For starting the services in the background (detached mode) docker-compose up -d // For stopping the services docker-compose stop
- Test whether both the default Tomcat web app and MySQL server can be accessed. Access the URL 192.168.99.100:8080, and make sure that the web page as shown in Figure 1.20 is displayed. Also, open MySQL Workbench and access the MySQL server at IP 192.168.99.100 and port 3326 (as specified in the preceding docker-compose.yml file).
推薦閱讀
- Vue.js 3.x快速入門
- OpenStack Cloud Computing Cookbook(Third Edition)
- Cocos2d Cross-Platform Game Development Cookbook(Second Edition)
- 數(shù)據(jù)庫系統(tǒng)原理及MySQL應(yīng)用教程(第2版)
- JavaScript百煉成仙
- React Native Cookbook
- 算法精粹:經(jīng)典計算機科學(xué)問題的Java實現(xiàn)
- Groovy for Domain:specific Languages(Second Edition)
- 假如C語言是我發(fā)明的:講給孩子聽的大師編程課
- Ext JS 4 Web Application Development Cookbook
- Scientific Computing with Scala
- Jenkins Continuous Integration Cookbook(Second Edition)
- Visual Basic程序設(shè)計
- Bootstrap 4 Cookbook
- Spring Security Essentials