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

  • 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.

主站蜘蛛池模板: 兴海县| 子洲县| 博客| 灵台县| 宁国市| 延边| 扶沟县| 澳门| 平阴县| 伊金霍洛旗| 泰宁县| 金川县| 利津县| 呼图壁县| 许昌市| 克拉玛依市| 红安县| 手机| 阳春市| 武定县| 游戏| 昭觉县| 金华市| 汽车| 辉南县| 云梦县| 佳木斯市| 黄冈市| 平昌县| 莫力| 札达县| 兰坪| 永仁县| 潼南县| 绥宁县| 桦甸市| 会理县| 天长市| 鄯善县| 和平县| 东乌珠穆沁旗|