composerize/composerize
Fork: 222 Star: 3187 (更新于 2024-11-11 13:05:47)
license: MIT
Language: JavaScript .
🏃→🎼 docker run asdlksjfksdf > docker-composerize up
最后发布版本: v1.4.1 ( 2023-10-22 04:01:11)
composerize
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
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
See composerize --help
for more options.
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 composerize = 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 = composerize(dockerRunCommand);
console.log(composeConfig);
You can also merge docker run command(s) with an existing Docker Compose file content :
const composerize = 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 = composerize(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
:
- 'v2x'
- 'v3x'
- 'latest'
const composerize = 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 = composerize(dockerRunCommand, null, 'v2x');
console.log(composeConfig);
You can also choose indentation level by specifying a fourth parameter indent
on convertDockerRunToCompose
:
- 'v2x'
- 'v3x'
- 'latest'
const composerize = 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 = composerize(dockerRunCommand, null, 'latest', 2);
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
Maintainers
- Mark Larah (Twitter: @mark_larah)
- ShareVB GitHub
最近版本更新:(数据更新于 2024-10-02 10:30:08)
2023-10-22 04:01:11 v1.4.1
2023-03-09 13:39:38 v1.2.0
2022-08-07 06:15:20 v1.1.0
2019-08-12 16:56:36 v1.0.3
2017-10-15 11:34:35 v1.0.2
2017-09-27 00:19:09 v1.0.1
2017-09-27 00:12:15 v1.0.0
主题(topics):
docker, docker-compose, dockerfile
composerize/composerize同语言 JavaScript最近更新仓库
2024-11-21 23:03:24 bia-pain-bache/BPB-Worker-Panel
2024-11-21 22:46:48 MHSanaei/3x-ui
2024-11-21 07:00:59 nodejs/node
2024-11-21 00:49:46 FortAwesome/Font-Awesome
2024-11-18 14:26:02 projectdiscovery/nuclei-templates
2024-11-17 14:42:23 koodo-reader/koodo-reader