New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

devkits-docker-compose-parser

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devkits-docker-compose-parser

Parse and generate docker-compose.yml files. Build compose configurations programmatically. Zero-dependency Docker Compose utility.

latest
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

@devkits/docker-compose-parser

Part of DevKits

Parse and generate docker-compose.yml files. Build compose configurations programmatically. Zero-dependency Docker Compose utility.

💰 Support DevKits

Love these tools? Support development via Open Collective

  • $5/mo - Supporter (priority support)
  • $9/mo - Pro (early access to new tools)
  • $29 - Lifetime (all current + future Pro features)

💎 Upgrade to DevKits Pro

Get access to 20+ premium tools including SQL to Code, Data Faker, JWT Generator, and more — all for $9 one-time.

→ Unlock DevKits Pro

💡 Pay with Crypto: BTC, ETH, USDT (TRC-20), SOL accepted. View crypto addresses

🧰 DevKits Pro Tools

This package is part of DevKits — 82+ free developer tools. The online Docker Compose Generator includes 20+ templates (Node+Mongo, Python+Postgres, etc.).

Browse Docker Templates

Installation

npm install @devkits/docker-compose-parser

Usage

const { parse, generate, getServices, validate, createService, TEMPLATES } = require('@devkits/docker-compose-parser');

// Parse docker-compose.yml
const yaml = `
version: "3.8"
services:
  web:
    image: nginx
    ports:
      - "80:80"
    volumes:
      - ./html:/usr/share/nginx/html
  db:
    image: postgres:16
    environment:
      - POSTGRES_PASSWORD=secret
`;

const config = parse(yaml);
// { version: '3.8', services: { web: {...}, db: {...} } }

// Get service names
getServices(config);
// ['web', 'db']

// Validate configuration
validate(config);
// { valid: true, errors: [] }

// Generate docker-compose.yml from object
const newConfig = {
  version: '3.8',
  services: {
    app: createService({
      image: 'node:20-alpine',
      build: '.',
      ports: ['3000:3000'],
      environment: ['NODE_ENV=production'],
      volumes: ['.:/app']
    })
  }
};

const yamlOut = generate(newConfig);
// version: "3.8"
// services:
//   app:
//     image: node:20-alpine
//     build: .
//     ...

// Use built-in templates
const template = TEMPLATES['node-mongo'];
const templateYaml = generate(template);

API

parse(yaml)

Parses a docker-compose YAML string into a JavaScript object.

generate(config)

Generates docker-compose.yml string from a config object.

getServices(config)

Returns array of service names from a parsed config.

validate(config)

Validates a docker-compose config, returns {valid, errors}.

createService(options)

Helper to create a service configuration object.

TEMPLATES

Built-in templates for common stacks (node-mongo, python-postgres, etc.).

Supported Properties

PropertyDescription
imageDocker image to use
buildBuild context path
portsPort mappings (host:container)
environmentEnvironment variables
volumesVolume mounts
depends_onService dependencies
restartRestart policy

See Also

🔧 More DevKits Tools

Free Tools (82+):

ToolDescription
base64-toolBase64 encode/decode
chmod-calculatorUnix permissions converter
cron-parserCron expression parser
csv-json-converterCSV ↔ JSON converter
diff-checkerText comparison (LCS)

Browse All 82+ Free Tools

💎 DevKits Pro — $9 One-Time

Unlock 20+ premium tools with a single payment:

→ Unlock DevKits Pro for $9

💡 Pay with Crypto: BTC, ETH, USDT (TRC-20), SOL accepted

🚀 Other Products from Us

ProductDescription
InvoicelyFree invoice generator for freelancers
SnapOGFree OG image generator (20+ templates)

License

MIT

Keywords

docker-compose

FAQs

Package last updated on 11 Mar 2026

Related posts