https://decomposerize.com - Turns Docker Compose files into docker run commands.
Looking for the reverse? https://composerize.com / Composerize
Want to convert between Docker Compose file formats? https://composeverter.com / Composeverter
Install globally:
npm install -g better-decomposerizeThen run:
decomposerize docker-compose.ymlYou can also pass options before the compose file:
decomposerize --docker-run --multiline docker-compose.ymlIf input is piped or redirected, decomposerize reads from stdin:
cat docker-compose.yml | decomposerize --docker-run
decomposerize --docker-run < docker-compose.ymlIf neither a compose file nor stdin input is provided, the CLI exits with an error and prints the help message.
Usage: decomposerize [options] <compose-file>
--help,-hDisplays the help message.--services=service1,service2Includes only the selected services. Default: all services.--docker-runAddsdocker runcommands to the output.--docker-run-command=<cmd>Defines the Docker command to generate, for exampledocker run,docker create, ordocker container run.--docker-run-rmAdds--rmto generateddocker runcommands.--docker-run-detachAdds-dto generateddocker runcommands.--docker-buildAddsdocker buildcommands.--stop-and-removeDisplaysdocker stopanddocker rmcommands for your containers.--create-volumesDisplaysdocker volume createcommands.--create-networksDisplaysdocker network createcommands.--delete-imagesDisplaysdocker rmicommands to delete images of a repository.--ansible-env-vars-formatEmits the command in Ansible environment variables format.--multilineEmits commands in multiline shell format.--long-argsEmits long command-line arguments when available.--arg-value-separator=<sep>Sets the separator between argument names and values. Allowed values:' 'or'='.
A Docker image of the Composerize, Decomposerize, and Composeverter websites is available here: https://github.com/Oaklight/composerize-minimal/blob/master/README_en.md
Thanks to @Oaklight.
The package exports a function that converts Docker Compose content into Docker commands.
const decomposerize = require('better-decomposerize');decomposerize(dockerComposeContent, configuration = {})dockerComposeContent: a string containing the Docker Compose YAML.configuration: optional configuration object.
Supported configuration fields:
services: string[]stopAndRemoveContainers: booleancreateVolumes: booleancreateNetworks: booleandockerBuild: booleandockerRun: booleandockerRunCommand: stringdockerRunRm: booleandockerRunDetach: booleandeleteImages: booleanansibleEnvVarsFormat: booleanmultiline: boolean'long-args': boolean'arg-value-separator': ' ' | '='
const decomposerize = require('better-decomposerize');
const dockerComposeInput = `
version: '3'
services:
myapp:
image: myapp-image
`;
const configuration = {
dockerRun: true,
dockerRunCommand: 'docker run',
dockerRunRm: true,
dockerRunDetach: false,
multiline: true,
'long-args': false,
'arg-value-separator': ' ',
};
const output = decomposerize(dockerComposeInput, configuration);
console.log(output);Install dependencies from the repository root:
yarnThen work inside the package:
cd packages/decomposerizemake eslint
make test
make build
make rebuild
make release
make publishdist/decomposerize.js→ library bundledist/cli.bundle.js→ bundled npm CLIdist/decomposerize→ standalone executable built with Node SEA
Build the standalone executable:
cd packages/decomposerize
make releaseRun it:
./dist/decomposerize docker-compose.ymlInstall it system-wide:
sudo make installInstall it under a custom prefix:
make install PREFIX=$HOME/.localUninstall it:
sudo make uninstall
make uninstall PREFIX=$HOME/.local- Clone a fork of the repo and install dependencies with
yarn - Make your changes inside
packages/decomposerize - Run
make eslint,make test, andmake build - Open a pull request
MIT