Skip to content

Instantly share code, notes, and snippets.

@ajayhn
Created November 23, 2015 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajayhn/39dccbcea2ec881b4636 to your computer and use it in GitHub Desktop.
Save ajayhn/39dccbcea2ec881b4636 to your computer and use it in GitHub Desktop.
bashrc
# Allows you to use docker-compose-exec {service} {command} to run a command on the service
docker_compose_exec() {
docker exec -it $(docker-compose -f compose.yml -p $(basename $PWD) ps | grep $1 | awk '{print $1}') ${@:2}
}
alias docker-compose-exec=docker_compose_exec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment