Created
October 3, 2019 02:15
-
-
Save mkamrani/81107f6d09b05c41db9026810333666a to your computer and use it in GitHub Desktop.
A handy alias to execute a command inside a docker container with a specific name (interactive mode)
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
# put this in ~/.bashrc, or ~/.zshrc, etc., then source ~/.bashrc or source ~/.zshrc | |
# Use it like dexec <containername> <command> : dexec node bash | |
dexec() { | |
name=${1} | |
command=${2} | |
docker exec -ti $(docker ps | grep $name | awk '{print $1}') $command | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment