The Whole Shebang: Compose Files

<p>You can read more about it from the&nbsp;<a href="https://docs.docker.com/compose/" rel="noopener ugc nofollow" target="_blank">official docs</a>, but to simplify, consider the following: you use&nbsp;<strong>Docker</strong>&nbsp;to manage containers, images, volumes, etc. When you do&nbsp;<code>docker run</code>&nbsp;you are basically executing a&nbsp;<strong>single</strong>&nbsp;container. If you want to start a second container, that somehow interacts with the first one, you&rsquo;ll need to run&nbsp;<code>docker run</code>&nbsp;again, and take care of their volumes and networks separately, such that they can see and communicate with each other.</p> <p>Docker Compose abstracts all of this, by providing a&nbsp;<strong>wrapper</strong>&nbsp;on top of Docker (yes! Docker Compose is simply a high-level CLI for Docker). In fact, you&rsquo;ll see that most options are named in a very similar way to the ones available in the&nbsp;<code>docker run</code>&nbsp;subcommand.</p> <p>With Docker Compose, you can&nbsp;<strong>declaratively</strong>&nbsp;define all of your containers (called&nbsp;<code>services</code>&nbsp;in the Docker Compose world&hellip;just because you can also use compose files in Swarm mode&hellip;but more on that in another article), volumes and networks, and their configurations, through YAML files called&nbsp;<strong>Compose Files</strong>. This way, whenever you need to manage your multi-container application, you only need to touch this compose file and then let Docker Compose take care of everything else.</p> <p><a href="https://betterprogramming.pub/the-whole-shebang-compose-files-5b6f50dd196c"><strong>Learn More</strong></a></p> <p>&nbsp;</p>
Tags: Compose Files