Docker Compose Explained
Learn how to create a YAML file for Docker containers and create containers using docker-compose.
Docker containers are created using the docker commands in the command line tool such as command prompt for Windows and terminal for Mac, Linux. Working in the command-line tool is easy when you beginning to learn Docker. However, if you are creating a complex Docker container such as creating multiple Docker containers and connecting them using the network. Managing the complex docker code/command is a tedious task. We have to use the backslash for multiple lines. Editing the commands in the terminal is also not an easy task. To address this problem, Docker proposed a new solution.
The solution is docker-compose. The docker-compose needs a YAML file. Put all the configuration code in the YAML file such as Image name, container name, host port and container, environment variables, etc. The YAML file format will be a little bit different from the Docker commands in the command line. I created a pictorial representation to understand it better.