Overview of a Multi-Container Application Setup
In the previous lesson, we introduced Docker and containerization. We ran sample Python and JavaScript scripts as demonstrations of how applications can be containerized and how images can be built. We are now ready to run an application that goes beyond that.
In a Dockerfile, every line describes a layer. The union filesystem used in Docker allows different directories to transparently overlay, forming a single, coherent filesystem. The foundational layer is always an image which you build upon. Each additional line with a command, say, RUN, CMD, and so on, adds a layer to it. The advantage of layers is that as long as the layer has not been modified, it will not bother building that part of the image. Secondly, as an image is pulled from a Docker image registry, it is pulled in layers, therefore mitigating issues such as connection cuts during pulling and pushing of images.
Many applications are built under a common structure: frontend, backend...