docker-composer
v5.1.0
Published
Library for generating docker-compose.yml from JSON.
Downloads
572
Maintainers
Readme
docker-composer
Generate Docker Compose descriptor from a JSON document.
About the package
The reason behind this package is support the Docker Compose descriptor generation from Javascript. You are able to use all Docker Compose keyword to describe your containers and services.
Docker Compose Reference is HERE.
Changes of the Latest Release
Version 5.1.0 (26.05.2024)
- Update dependencies
- Support aux_addresses keyword in network/ipam config object
- Support attachable keyword in network config object
You can find all Release Notes HERE.
Usage
const composer = require('docker-composer');
.
const generatedYML = composer.generate(inputJSON);
Full Example
Input
{
"version" : "3",
"services" :
{
"nginx" : {
"ports" : [
"80"
],
"image" : "nginx:latest"
},
"http" : {
"ports" : [
"443"
],
"image" : "apache:latest"
}
}
}
Result
---
version: "3"
services:
nginx:
ports:
- "80"
image: "nginx:latest"
http:
ports:
- "443"
image: "nginx:latest"
License
Copyright (c) 2015 Tibor Udvari. Released under the MIT license. See LICENSE for details.