38
37

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

「docker-compose [execとか] [サービス名] [コマンド可変]」ってタイプするのがだるい

Last updated at Posted at 2020-07-15

「イメージでいうとサービス名web決め打ちにして dcw exec bashとかしたい。エイリアスだと引数の順番のせいでできないし…」
「それ独自関数できるよ」
「マジっすか」

これがだるいので

docker-compose exec web |本命のコマンド|
# docker-compose exec web bash とか
# .zshrc にコピペ
dcw () { docker-compose $1 web "${@:2}" }
# .bashrcならこうらしい
dcw () {
 docker-compose $1 web "${@:2}"
}
dcw exec bash
# docker-compose exec web bash になる!

web のところは自分のdocker-composeの定義に置き換えてくれよな!

ついでにこれも見ていくといいんじゃない(私の記事ではないけど)

世の中のエンジニアのalias設定 - Qiita

一部抜粋

alias d='docker'
alias dc='docker-compose'
38
37
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
38
37

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?