Docs / Containers & Docker / Using Docker Init for Project Scaffolding

Using Docker Init for Project Scaffolding

By Admin · Jan 28, 2026 · Updated Apr 23, 2026 · 7 views · 2 min read

This guide covers how to set up and configure docker-init on a Linux VPS. Whether you're running a production environment or a development setup, these instructions will help you get started quickly and securely.

Prerequisites

  • Docker Compose v2 installed
  • A VPS running Ubuntu 22.04 or later (2GB+ RAM recommended)
  • Basic familiarity with the Linux command line
  • Root or sudo access to the server

Creating the Docker Compose File

Security should be a primary consideration when configuring docker-init. Always use strong passwords, keep software updated, and restrict network access to only the necessary ports and IP addresses.


# docker-compose.yml
version: '3.8'
services:
  app:
    image: docker-init:latest
    restart: unless-stopped
    ports:
      - "8080:8080"
    volumes:
      - app_data:/data
    environment:
      - NODE_ENV=production
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 10s
      retries: 3

volumes:
  app_data:

Each line in the configuration serves a specific purpose. The comments explain the reasoning behind each setting, making it easier to customize for your specific use case.

  • Set up fail2ban for brute force protection
  • Keep all software components up to date
  • Use strong, unique passwords for all services
  • Use SSH keys instead of password authentication

Building the Container Image

The docker-init configuration requires careful attention to resource limits and security settings. On a VPS with limited resources, it's important to tune these parameters according to your available RAM and CPU cores.


# Multi-stage Dockerfile
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build

FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
CMD ["node", "dist/index.js"]

This configuration provides a good balance between performance and resource usage. For high-traffic scenarios, you may need to increase the limits further.

Important Notes

After applying these changes, monitor the server's resource usage for at least 24 hours to ensure stability. Tools like htop, iostat, and vmstat can provide real-time insights into system performance.

  • Maintain runbooks for common operations
  • Use version control for configuration files
  • Document all configuration changes
  • Set up monitoring before going to production
  • Test disaster recovery procedures regularly

Wrapping Up

Following this guide, your docker-init setup should be production-ready. Keep an eye on resource usage as your traffic grows and don't forget to test your backup and recovery procedures periodically.

Was this article helpful?