Skip to content

Instantly share code, notes, and snippets.

@rodrigobaron
Last active August 2, 2016 07:04
Show Gist options
  • Save rodrigobaron/64ea67f374b36db70542e6e3636c98b1 to your computer and use it in GitHub Desktop.
Save rodrigobaron/64ea67f374b36db70542e6e3636c98b1 to your computer and use it in GitHub Desktop.
Windows alternative to 'Interactive mode is not yet supported on Windows.' on docker-compose run issue
#!/bin/bash
function docker-compose-run() {
if [ "$1" = "-f" ] || [ "$1" = "--file" ] ; then
docker exec -i $(docker-compose -f $2 ps $3 |grep -m 1 $3 | cut -d ' ' -f1) "${@:4}"
else
docker exec -i $(docker-compose ps $1 | grep -m 1 $1 | cut -d ' ' -f1) "${@:2}"
fi
}
docker-compose-run "$@"
@rodrigobaron
Copy link
Author

rodrigobaron commented May 16, 2016

you can put the function in ~/.zshrc or ~/.bashrc file using babun or cygwin... (i'm tested on babun)

usage:

docker-compose-run web rspec
.....

Finished in 0.10388 seconds (files took 0.81483 seconds to load)
5 examples, 0 failures

or:

docker-compose-run -f docker-compose.development.yml web rspec
.....

Finished in 0.09654 seconds (files took 0.85014 seconds to load)
5 examples, 0 failures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment