Docker ABC


Intoduction to Docker


Docker Compose
To create multi-container application (Stack). It allows you to compose multiple services (containing a docker image) in a single file.

A compose file can consist of multiple services (containing a docker image).
All services within a compose file will join the same "network".
By default, the name of the service within the compose file will be the host name of that container within the same network. E.g in following compose file:

services:
    db:
        image: ...
    application:
        image: ...

the host name of the database from within the application container will be "db".


LIMITATION: docker compose file will only run on one single machine. (Use docker swarm for that purpose). However, the compose file can be used to run on a swarm.




Introduction to Docker Swarm



                                                                                     Swarm
                                                                                         |
                                                                 ------------------------------------
                                                                 |                                          |
                                                          Node1                                   Node n
                                                                 |                                       . . .
                                        -------------------------------------------
                                       |                                                   |
                                Stack1                                          Stack n
                                      |                                                    |
                      -----------------------------                  -----------------------------
                      |                                 |                  |                                  |
              Service1                     Service n    Service 1                    Service n
     
Terminology
Swarm: One or more nodes
Node: Physical or virtual machine running a docker engine in swarm mode
Stack: Group of services
Service: Group of containers of the same image
Task: is started by a service and executes the actual container
Scale: Once you have deployed a service to a swarm, you are ready to use the Docker CLI to scale the number of containers in the service