- 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.
- 全屋互聯(lián):智能家居系統(tǒng)開發(fā)指南
- Cybersecurity:Attack and Defense Strategies
- Learning Windows Server Containers
- 操作系統(tǒng)基礎(chǔ)與實踐:基于openEuler平臺
- 精通Linux內(nèi)核開發(fā)
- Linux操作系統(tǒng)應(yīng)用編程
- 異質(zhì)結(jié)原理與器件
- Instant Optimizing Embedded Systems using Busybox
- 深入淺出Node.js
- 計算機系統(tǒng)的自主設(shè)計
- 跟老男孩學Linux運維:Shell編程實戰(zhàn)
- Windows 7實戰(zhàn)從入門到精通(超值版)
- Windows Vista終極技巧金典
- Linux應(yīng)用大全 基礎(chǔ)與管理
- Raspberry Pi入門指南