Launch a Development Environment with Docker Compose
Explore how to launch a Node.js development environment using Docker Compose by building custom images, setting environment variables, mounting host directories, and enabling remote debugging with port exposure.
We'll cover the following...
We'll cover the following...
Docker Compose
Docker Compose can override the image’s default production settings to launch a container in development mode. We will use the following docker-compose.yml:
Before we referenced a specific image: from Docker Hub. In this file, a build: option is used to create an image from a Dockerfile:
- The
context:is the relative path to the location of yourDockerfile. - The
dockerfile:is the name of yourDockerfile.
Additionally:
- The container name is set to
nodehello. - The
NODE_ENVenvironment variable is set todevelopment.Sometimes, setting the
NODE_ENVis not overridden with Dockerfile (in our case it’s set toproduction). It’s because, at the building of the image, the environment variables are set as specified in ...