Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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](h
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);
You can also choose indentation level by specifying a fourth parameter indent
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, 'latest', 2);
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 0 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.