Skip to content

Instantly share code, notes, and snippets.

@feiz
Created March 10, 2017 08:09
Show Gist options
  • Save feiz/9ab642f2c278738b9803519c0ffd3f7f to your computer and use it in GitHub Desktop.
Save feiz/9ab642f2c278738b9803519c0ffd3f7f to your computer and use it in GitHub Desktop.
dockerコンテナにガッとつなぐやつ
#!/bin/sh
# usage
# dcon PIECE_OF_CONTAINER_NAME [COMMAND [ARGUMENTS...]]
#
# example
# $ dcon app1
# $ dcon postg psql -U myuser mydatabase
name=$1
shift 1
command=$*
docker exec -ti $(docker ps -qf name=$name) ${command:-/bin/sh}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment