Skip to content

๐Ÿƒโ†’๐ŸŽผ docker run asdlksjfksdf > docker-composerize up

Notifications You must be signed in to change notification settings

exee21/composerize

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

composerize

Build Status npm Follow @mark_larah ShareVB on GitHub

http://composerize.com - Turns docker run commands into docker-compose files!

Looking for the reverse : http://decomposerize.com / Decomposerize

Demo

CLI

composerize can be run in the cli.

npm install composerize -g to install, and run as such:

$ composerize docker run -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro --restart always --log-opt max-size=1g nginx

How to use with node.js

Make sure to install the composerize package in your project by running:

npm install composerize

With the following code, you can easily integrate Composerize into your Node.js project and generate Docker Compose configurations from Docker run commands.

const { convertDockerRunToCompose } = require('composerize');

const dockerRunCommand = 'docker run -d -p 8080:80 --name my-web-app nginx:latest';

// Convert the Docker run command to a Docker Compose configuration
const composeConfig = convertDockerRunToCompose(dockerRunCommand);

console.log(composeConfig);

You can also merge docker run command(s) with an existing Docker Compose file content :

const { convertDockerRunToCompose } = require('composerize');

const dockerRunCommand = 'docker run -d -p 8080:80 --name my-web-app nginx:latest';

// An existing Docker Compose configuration as a string
const existingComposeConfig = `
version: '3'
services:
  existing-service:
    image: my-existing-image:latest
    ports:
      - '8000:80'
`;

// Convert the Docker run command to a Docker Compose configuration and merge with provided docker compose
const composeConfig = convertDockerRunToCompose(dockerRunCommand, existingComposeConfig);

console.log(composeConfig);

Contributing

  • Clone a fork of the repo and install the project dependencies by running yarn
  • Make your changes, and build the project by running make build
  • Test your changes with make test

yarn version

Needs yarn@1.19.1. See yarnpkg/yarn#7734.

Maintainers

About

๐Ÿƒโ†’๐ŸŽผ docker run asdlksjfksdf > docker-composerize up

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.3%
  • HTML 3.3%
  • CSS 1.5%
  • Other 1.9%