bucherfa / docker-compose-converter

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%