Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
composerize
Advanced tools
[![Build Status](https://travis-ci.org/magicmark/composerize.svg?branch=master)](https://travis-ci.com/github/magicmark/composerize) [![npm](https://img.shields.io/npm/v/composerize.svg)](https://www.npmjs.com/package/composerize) [![Follow @mark_larah]
http://composerize.com - Turns docker run
commands into docker-compose.yml
files and even merge with existing docker-compose.yml
!
Looking for the reverse : http://decomposerize.com / Decomposerize
Want to convert from Docker compose file formats : http://composeverter.com / Composeverter
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
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);
You can also choose which version of Docker compose V2, you target : 2.x, 3.x or Common Specification by specifying a third parameter composeVersion
on convertDockerRunToCompose
:
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 for 2.x
const composeConfig = convertDockerRunToCompose(dockerRunCommand, null, 'v2x');
console.log(composeConfig);
yarn
make build
make test
Needs yarn@1.19.1. See https://github.com/yarnpkg/yarn/issues/7734.
FAQs
[![Build Status](https://travis-ci.org/magicmark/composerize.svg?branch=master)](https://travis-ci.com/github/magicmark/composerize) [![npm](https://img.shields.io/npm/v/composerize.svg)](https://www.npmjs.com/package/composerize) [![Follow @mark_larah](h
The npm package composerize receives a total of 97 weekly downloads. As such, composerize popularity was classified as not popular.
We found that composerize demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.