docker.recipes

VS Code Dev Container Fullstack

intermediate

Complete development environment with VS Code Server and fullstack tools.

Overview

code-server brings VS Code's full IDE experience to any device through a web browser, eliminating the need for local installations while maintaining access to extensions, integrated terminals, and debugging capabilities. Originally created by Coder to enable remote development, it has become the foundation for cloud-based development environments that offer consistent tooling across teams and devices. This fullstack development container combines code-server with Node.js 20 and Python 3.11 runtimes alongside PostgreSQL for robust relational data storage and Redis for high-performance caching and session management. The stack includes MailHog for email testing during development and Adminer for database administration, creating a complete development ecosystem within isolated containers. Remote development teams, consultants working across multiple client environments, and organizations standardizing development toolchains will find this combination particularly valuable for maintaining consistency while enabling flexible access from any device with a modern web browser.

Key Features

  • Full VS Code interface accessible through web browser with extension marketplace support
  • Node.js 20 Alpine runtime with persistent node_modules volume for JavaScript/TypeScript development
  • Python 3.11 slim container with virtual environment persistence for backend API development
  • PostgreSQL 15 with ACID compliance, JSON/JSONB support, and full-text search capabilities
  • Redis 7 in-memory data structures for sub-millisecond caching, session storage, and pub/sub messaging
  • MailHog SMTP testing server with web interface for capturing and inspecting development emails
  • Adminer web-based database administration with support for PostgreSQL schema management
  • Persistent workspace synchronization across container restarts and updates

Common Use Cases

  • 1Remote fullstack development teams building web applications with JavaScript frontend and Python backend
  • 2Consulting developers who need consistent environments across different client projects and machines
  • 3Educational institutions providing standardized development environments for coding bootcamps and computer science courses
  • 4Companies developing applications with PostgreSQL databases requiring email functionality testing
  • 5Freelancers working on Chromebooks or tablets who need access to a full development environment
  • 6Startups building MVP applications with real-time features using Redis pub/sub and PostgreSQL persistence
  • 7Development teams creating API services that require session management, caching, and transactional data storage

Prerequisites

  • Docker Engine 20.10+ and Docker Compose V2 with minimum 4GB RAM allocated to containers
  • Available ports 8443, 8080, 8025, 1025, 5432, and 6379 on the host system
  • CODE_PASSWORD and POSTGRES_PASSWORD environment variables configured in .env file
  • Basic understanding of VS Code extensions and terminal usage for development workflows
  • Familiarity with PostgreSQL connection strings and Redis CLI commands for database interactions
  • Modern web browser with JavaScript enabled for accessing code-server interface

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 code-server:
3 image: codercom/code-server:latest
4 ports:
5 - "8443:8443"
6 environment:
7 - PASSWORD=${CODE_PASSWORD}
8 volumes:
9 - ./workspace:/home/coder/project
10 - code_server_data:/home/coder/.local
11 user: root
12 networks:
13 - dev_net
14
15 node:
16 image: node:20-alpine
17 working_dir: /app
18 volumes:
19 - ./workspace:/app
20 - node_modules:/app/node_modules
21 command: tail -f /dev/null
22 networks:
23 - dev_net
24
25 python:
26 image: python:3.11-slim
27 working_dir: /app
28 volumes:
29 - ./workspace:/app
30 - python_venv:/app/.venv
31 command: tail -f /dev/null
32 networks:
33 - dev_net
34
35 postgres:
36 image: postgres:15-alpine
37 environment:
38 - POSTGRES_USER=dev
39 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
40 - POSTGRES_DB=devdb
41 volumes:
42 - postgres_data:/var/lib/postgresql/data
43 ports:
44 - "5432:5432"
45 networks:
46 - dev_net
47
48 redis:
49 image: redis:7-alpine
50 ports:
51 - "6379:6379"
52 volumes:
53 - redis_data:/data
54 networks:
55 - dev_net
56
57 mailhog:
58 image: mailhog/mailhog:latest
59 ports:
60 - "1025:1025"
61 - "8025:8025"
62 networks:
63 - dev_net
64
65 adminer:
66 image: adminer:latest
67 ports:
68 - "8080:8080"
69 networks:
70 - dev_net
71
72volumes:
73 code_server_data:
74 node_modules:
75 python_venv:
76 postgres_data:
77 redis_data:
78
79networks:
80 dev_net:

.env Template

.env
1# Dev Container
2CODE_PASSWORD=secure_code_password
3POSTGRES_PASSWORD=secure_postgres_password
4
5# Code Server at http://localhost:8443
6# Mailhog at http://localhost:8025
7# Adminer at http://localhost:8080

Usage Notes

  1. 1Code Server at http://localhost:8443
  2. 2Mailhog for email testing at http://localhost:8025
  3. 3Adminer at http://localhost:8080
  4. 4Node and Python containers ready
  5. 5Install extensions in Code Server

Individual Services(7 services)

Copy individual services to mix and match with your existing compose files.

code-server
code-server:
  image: codercom/code-server:latest
  ports:
    - "8443:8443"
  environment:
    - PASSWORD=${CODE_PASSWORD}
  volumes:
    - ./workspace:/home/coder/project
    - code_server_data:/home/coder/.local
  user: root
  networks:
    - dev_net
node
node:
  image: node:20-alpine
  working_dir: /app
  volumes:
    - ./workspace:/app
    - node_modules:/app/node_modules
  command: tail -f /dev/null
  networks:
    - dev_net
python
python:
  image: python:3.11-slim
  working_dir: /app
  volumes:
    - ./workspace:/app
    - python_venv:/app/.venv
  command: tail -f /dev/null
  networks:
    - dev_net
postgres
postgres:
  image: postgres:15-alpine
  environment:
    - POSTGRES_USER=dev
    - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    - POSTGRES_DB=devdb
  volumes:
    - postgres_data:/var/lib/postgresql/data
  ports:
    - "5432:5432"
  networks:
    - dev_net
redis
redis:
  image: redis:7-alpine
  ports:
    - "6379:6379"
  volumes:
    - redis_data:/data
  networks:
    - dev_net
mailhog
mailhog:
  image: mailhog/mailhog:latest
  ports:
    - "1025:1025"
    - "8025:8025"
  networks:
    - dev_net
adminer
adminer:
  image: adminer:latest
  ports:
    - "8080:8080"
  networks:
    - dev_net

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 code-server:
5 image: codercom/code-server:latest
6 ports:
7 - "8443:8443"
8 environment:
9 - PASSWORD=${CODE_PASSWORD}
10 volumes:
11 - ./workspace:/home/coder/project
12 - code_server_data:/home/coder/.local
13 user: root
14 networks:
15 - dev_net
16
17 node:
18 image: node:20-alpine
19 working_dir: /app
20 volumes:
21 - ./workspace:/app
22 - node_modules:/app/node_modules
23 command: tail -f /dev/null
24 networks:
25 - dev_net
26
27 python:
28 image: python:3.11-slim
29 working_dir: /app
30 volumes:
31 - ./workspace:/app
32 - python_venv:/app/.venv
33 command: tail -f /dev/null
34 networks:
35 - dev_net
36
37 postgres:
38 image: postgres:15-alpine
39 environment:
40 - POSTGRES_USER=dev
41 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
42 - POSTGRES_DB=devdb
43 volumes:
44 - postgres_data:/var/lib/postgresql/data
45 ports:
46 - "5432:5432"
47 networks:
48 - dev_net
49
50 redis:
51 image: redis:7-alpine
52 ports:
53 - "6379:6379"
54 volumes:
55 - redis_data:/data
56 networks:
57 - dev_net
58
59 mailhog:
60 image: mailhog/mailhog:latest
61 ports:
62 - "1025:1025"
63 - "8025:8025"
64 networks:
65 - dev_net
66
67 adminer:
68 image: adminer:latest
69 ports:
70 - "8080:8080"
71 networks:
72 - dev_net
73
74volumes:
75 code_server_data:
76 node_modules:
77 python_venv:
78 postgres_data:
79 redis_data:
80
81networks:
82 dev_net:
83EOF
84
85# 2. Create the .env file
86cat > .env << 'EOF'
87# Dev Container
88CODE_PASSWORD=secure_code_password
89POSTGRES_PASSWORD=secure_postgres_password
90
91# Code Server at http://localhost:8443
92# Mailhog at http://localhost:8025
93# Adminer at http://localhost:8080
94EOF
95
96# 3. Start the services
97docker compose up -d
98
99# 4. View logs
100docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/devcontainer-fullstack/run | bash

Troubleshooting

  • code-server shows 'VS Code Server failed to start': Ensure CODE_PASSWORD environment variable is set and container has sufficient memory allocation
  • Node.js modules not persisting between restarts: Verify node_modules volume is properly mounted and the container has write permissions to /app directory
  • PostgreSQL connection refused from other containers: Check that services are on the same dev_net network and use service name 'postgres' instead of localhost
  • Redis commands timeout or fail: Confirm Redis container is running and accessible on port 6379 within the Docker network, not from external connections
  • MailHog not capturing emails from applications: Configure SMTP settings to use mailhog:1025 as the server address within the container network
  • Adminer cannot connect to PostgreSQL: Use server name 'postgres', username 'dev', and ensure POSTGRES_PASSWORD matches the environment variable

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Components

code-servernodepythonpostgresqlredis

Tags

#devcontainer#vscode#fullstack#remote#development

Category

Development Tools
Ad Space