Created
January 5, 2017 02:18
-
-
Save nyaocat/cb1366ab028caeeb56283899555818bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: docker-edit container filepath | |
# License: NYSL | |
set -eu | |
TMPFILE=$(mktemp) | |
trap "rm $TMPFILE" 0 | |
docker cp $1:$2 $TMPFILE | |
${EDITOR:-vi} $TMPFILE | |
docker cp $TMPFILE $1:$2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
docker-edit
という名前で$PATH
の通っている場所に置くと、という記述で手元で docker コンテナ内のファイルが編集できる。エディタは環境変数
$EDITOR
を参照している。