Search⌘ K
AI Features

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.

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:

YAML
version: '3'
services:
nodehello:
environment:
- NODE_ENV=development
build:
context: ./
dockerfile: Dockerfile
container_name: nodehello
volumes:
- ./:/home/node/app
ports:
- "3000:3000"
- "9229:9229"
command: /bin/sh -c 'npm install && npm run debug'

Before we referenced a specific image: from Docker Hub. In this file, a build: option is used to create an image from a ...