npm.io
0.2.0 • Published 7 years ago

docker-compose-converter

Licence
GNU GPLv3
Version
0.2.0
Deps
2
Size
48 kB
Vulns
0
Weekly
0
Stars
17

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);

Keywords