Next.js — Local Development With Docker-Compose
An example project with Next.js, Nodejs API
Docker Compose is really useful when we don’t have the development environment setup on our local machine to run all parts of the application to test or we want to run all parts of the application with one command. For example, if you want to run Next.js and nodeJS express server on different ports and need a single command to set up and run the whole thing. You can accomplish that with Docker Compose.
In this post, we will see what is Docker Compose and how we can do the local development with Docker Compose and advantages as well.
- What is Docker Compose
- Example Project
- Run Without Docker Compose
- With Docker Compose
- Communication Between Services
- Summary
- Conclusion
What is Docker Compose
Docker-compose is a tool that is used for multi-container applications in a single host. As we can see in the following figure, we can run multi containers as services in a single host with the help of docker-compose.yaml.
Once we install docker-compose, basically, we need to follow these three steps