Help us understand the problem. What is going on with this article?

tmux使用時にdockerコンテナに入った際、paneの背景色を変えるalias

More than 1 year has passed since last update.

前提

  • tmux
  • docker

source

.zshrc
alias docker-login='(){tmux select-pane -P "fg=4,bg=colour236"; docker exec -it $1 bash -lc "su - $2";tmux select-pane -P "fg=default,bg=default" }'

見たままだけど、内容としては、dockerの中にloginする際にtmuxのpaneのカラーを変更して、抜けたら元の色にもどしている。

docker execの部分をsshに変更したら、dockerじゃなくてsshでどこかのリモートサーバにログインした時もカラー変更したりできる。

使い方

ここの部分はどこかのqiitaに書いてあったまんま

# amasokユーザでログイン
docker-login 7b566329da7f amasok
# rootユーザでログイン
docker-login 7b566329da7f

これで、dockerにアクセスしてる最中は背景色と文字色が変わる。

tmux select-pane -P "fg=4,bg=colour236"

上のfgとbgを変えると色を変更できる。
抜けたら元の色に戻る。

参考

あったんだけど、忘れた。。見つけられない。。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away