官术网_书友最值得收藏!

  • Docker for Developers
  • Richard Bullington McGuire Andrew K. Dennis Michael Schwartz
  • 354字
  • 2021-06-11 18:15:24

Chapter 4: Composing Systems Using Containers

In the previous chapter, we created a server-side application using microservices architecture. The application was made up of five separate containers: three official images and two custom images. The official images were for MongoDB, Redis, and Mosca (MQTT).

For the most part, communication between containers is done via MQTT message passing. The subscriber container carries out the database Create, Read, Update, and Delete (CRUD) operations via the Node.js API for MongoDB and Redis. All of the relevant network ports are exposed on the development host, enabling the subscriber program to access the database servers at localhost (127.0.0.1) and both subscriber and publisher programs to access Mosca/MQTT at localhost, too.

In this chapter, we are going to discuss composing systems—specifically, Docker Compose.  We are also going to learn how to keep network access private so that services can be accessed from within our containers but not be accessible from the host. We will learn how we can share volumes in the filesystem between containers. There are alternatives to Docker Compose, and we will look at some of them.

We will cover the following topics in this chapter:

  • Introduction to Docker Compose
  • Using Docker local networking
  • Local volumes
  • Other composition tools

To recap, we have three official image containers for MongoDB, Mosca, and Redis. We have an additional two containers created for this book—publisher and subscriber microservices.  

The publisher microservice has been modified to present a form in a web browser. The fields in the form and the submit buttons allow us to exercise the various operations supported by the subscriber microservice:

Figure 4.1 – The form generated by our updated publisher program

You can choose which database to perform CRUD operations on. You can also set a value that is to be used for the List, Count, Add, and Remove operations. There is a button for each of the CRUD operations, as well as a Flush button, which removes all the records from the selected database. The return value/result of the operation is shown beneath the form under the Result heading.

主站蜘蛛池模板: 南丰县| 东平县| 余江县| 洪雅县| 彭阳县| 会泽县| 钦州市| 汪清县| 阿鲁科尔沁旗| 锡林浩特市| 类乌齐县| 四川省| 望城县| 屏东县| 景泰县| 永康市| 页游| 壤塘县| 扎赉特旗| 微山县| 宝坻区| 中牟县| 宁强县| 肥东县| 乐都县| 繁峙县| 深泽县| 铜陵市| 新平| 广灵县| 密云县| 无极县| 沽源县| 清流县| 梅河口市| 辽源市| 沈阳市| 精河县| 故城县| 游戏| 筠连县|