https://github.com/composerize/decomposerize
Turn your Docker compose file to Docker run commands
https://github.com/composerize/decomposerize
Last synced: about 1 year ago
JSON representation
Turn your Docker compose file to Docker run commands
- Host: GitHub
- URL: https://github.com/composerize/decomposerize
- Owner: composerize
- License: mit
- Created: 2023-09-26T06:30:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-28T13:46:54.000Z (about 1 year ago)
- Last Synced: 2025-03-30T20:11:11.972Z (about 1 year ago)
- Language: JavaScript
- Size: 3.4 MB
- Stars: 107
- Watchers: 3
- Forks: 10
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# decomposerize
[](https://app.netlify.com/sites/decomposerize/deploys)
[](https://www.npmjs.com/package/decomposerize)
[](https://github.com/sharevb)
http://decomposerize.com - Turns docker-compose file into `docker run` commands!
Looking for the reverse : http://composerize.com / [Composerize](https://github.com/magicmark/composerize)
Want to convert from Docker compose file formats : http://composeverter.com / [Composeverter](https://github.com/outilslibre/composeverter)
## CLI
decomposerize can be run in the cli.
`npm install decomposerize -g` to install, and run as such:
```bash
$ decomposerize << docker-compose.yml
```
## Docker image
A dockker image of composerize, decomposerize and composeverter websites is available here: https://github.com/Oaklight/composerize-minimal/blob/master/README_en.md (thanks to @Oaklight)
## API
**convertToDockerRunCommands(dockerComposeContent, configuration={})**
- `dockerComposeContent`: A string representing the Docker Compose file input.
- `configuration`: optional configuration options in form of an object
- `command`: A string that defines the Docker command to generate (e.g., 'docker run', 'docker create', 'docker container run'). It has a default value of 'docker run'.
- `rm`: A boolean that, when true, adds the '--rm' option to the command line arguments. The default value is `false`.
- `detach`: A boolean that, when true, adds the '-d' option to the command line arguments. The default value is `false`.
- `multiline`: A boolean that, when true, emits the command in multiline shell command format. The default value is `false`.
- `'long-args'`: A boolean that, when true, emits long command line arguments (e.g., '--tty' instead of '-t'). The default value is `false`.
- `'arg-value-separator'`: A string representing the separator used between command arguments and their values. It can be either ' ' (space) or '='. The default value is ' ' (space).
**returns**
It returns the Docker run command(s) generated based on the input Docker Compose file and the provided configuration
### How to use with node.js
Make sure to install the `composerize` package in your project by running:
```bash
npm install decomposerize
```
With the following code, you can easily integrate **Decomposerize** into your Node.js project and generate Docker run command(s) from Docker Compose configurations.
```javascript
const convertToDockerRunCommands = require('decomposerize');
const dockerComposeInput = `
version: '3'
services:
myapp:
image: myapp-image
`;
const configuration = {
command: 'docker run',
rm: true,
detach: false,
multiline: true,
'long-args': false,
'arg-value-separator': ' ',
};
const dockerRunCommands = convertToDockerRunCommands(dockerComposeInput, configuration);
console.log('Generated Docker Run Commands:');
console.log(dockerRunCommands);
```
## Contributing
- [Clone a fork of the repo](https://guides.github.com/activities/forking/) 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
- ShareVB [GitHub](https://github.com/sharevb)