- 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.
- 30天自制操作系統(tǒng)
- Ansible權(quán)威指南
- macOS效率手冊
- 新手學電腦從入門到精通(Windows 10+Office 2016版)
- 移動應用UI設計模式(第2版)
- Android物聯(lián)網(wǎng)開發(fā)細致入門與最佳實踐
- 完美應用RHEL 8
- jQuery UI Cookbook
- 新編電腦辦公(Windows 10+ Office 2013版)從入門到精通
- 跟老男孩學Linux運維:Shell編程實戰(zhàn)
- Linux網(wǎng)絡配置與安全管理
- 統(tǒng)信UOS應用開發(fā)進階教程
- Windows Server 2008組網(wǎng)技術(shù)與實訓(第3版)
- Android應用性能優(yōu)化最佳實踐
- Office 365 User Guide