0.2.0 • Published 5 years ago

docker-compose-converter v0.2.0

Weekly downloads
4
License
GNU GPLv3
Repository
github
Last release
5 years ago

docker-compose Converter

Convert docker run/create commands to docker-compose.yml files.

Online Demo

Example

Input

docker run -d \
  -v nextcloud:/var/www/html \
  nextcloud
docker run -d \
  -v db:/var/lib/mysql \
  mariadb

Output

version: '3'
services:
  nextcloud:
    image: nextcloud
    volumes:
      - 'nextcloud:/var/www/html'
  mariadb:
    image: mariadb
    volumes:
      - 'db:/var/lib/mysql'

Usage

Install

npm install docker-compose-converter --save

Include

const dcc = require('docker-compose-converter');
const dockerRunCommands = `
docker run -d \
  -v nextcloud:/var/www/html \
  nextcloud
docker run -d \
  -v db:/var/lib/mysql \
  mariadb
`;
const dockercomposeyml = ddc(dockerRunCommands);
console.log(dockercomposeyml);