From the course: Docker for Developers: Create and Manage Docker Containers

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Writing a Docker Compose file

Writing a Docker Compose file

- [Instructor] Now that you're familiar with how docker compose works, let's take a look at it in practice. In the branch for this video, 04_02, I've updated our simple Node.js project. Now, it connects to a database, and allows the user to update the message that appears on the screen. This requires two containers to run, app and db. I've also added the compose.yml file. The purpose of a compose file is to define and manage multi-container docker applications in a single, easy-to-read configuration. You may also see this file named docker-compose.yml, which is a legacy feature that has been discontinued. We start with the Services section, which defines the different containers that will run in your application. In this case, you have two, app for the Node.js backend, and db for the Postgres Database. The app service defines the main application container. It'll run your Node.js app. Then, I've specified the image…

Contents