docker-multirundeprecated

Run a docker container via docker-run multiple times. Works like docker-compose by keeping the container and reusing the volumes.

Usage no npm install needed!

<script type="module">
  import dockerMultirun from 'https://cdn.skypack.dev/docker-multirun';
</script>

README

docker-multirun

npm version Linux macOS Windows compatible Build status Coverage status Dependency status Renovate enabled
Open in Gitpod Buy Me a Coffee PayPal Patreon

Run a docker container via docker-run multiple times. Works like docker-compose by keeping the container and reusing the volumes.

There are many cases where you run a task repeatedly, but do not want to throw away the whole container. One frequent task is running tests in a docker container. You want to keep the installed node_modules files and then run the tests multiple times.

docker-multirun is like docker-run, but reuses the volumes of the already-existing container. This way, generated files from the previous run are kept. This behavior is also known from docker-compose.

Install

# npm
$ npm install docker-multirun

# Yarn
$ yarn add docker-multirun

Usage

# Using yarn
$ npx docker-multirun node:12 bash -c "npm ci && npm test"

# Using npm
$ yarn docker-multirun node:12 bash -c "yarn --frozen-lockfile && yarn test"

# Mounting volumes
$ yarn docker-multirun node:12 -v $(pwd):/app -v /app/node_modules bash -c "yarn --frozen-lockfile && yarn test"
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...

# Run it again
$ yarn docker-multirun node:12 -v $(pwd):/app -v /app/node_modules bash -c "yarn --frozen-lockfile && yarn test"
[1/4] 🔍  Resolving packages...
success Already up-to-date.

# That was the fast lane!

Custom container name

You can give your container a custom name by using the --name option, which is part of docker-run.

Contribute

Are you missing something or want to contribute? Feel free to file an issue or a pull request! ⚙️

Support

Hey, I am Sebastian Landwehr, a freelance web developer, and I love developing web apps and open source packages. If you want to support me so that I can keep packages up to date and build more helpful tools, you can donate here:

Buy Me a Coffee  If you want to send me a one time donation. The coffee is pretty good 😊.
PayPal  Also for one time donations if you like PayPal.
Patreon  Here you can support me regularly, which is great so I can steadily work on projects.

Thanks a lot for your support! ❤️

License

MIT License © Sebastian Landwehr