Last active
August 30, 2019 03:33
-
-
Save yassermog/93d0fa446075439725100bd3eebc115f to your computer and use it in GitHub Desktop.
usful bash script that allow you to run a command inside a container as a root 1- change container_id in execdocker.sh 2- run bash execdocker.sh "your_command"
This file contains hidden or 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
| container_id="c9d1369a7478" # change container_id | |
| start="docker exec -u root -t -i "$container_id | |
| pass=$1 | |
| command=$start" "$pass | |
| RED='\033[0;31m' | |
| Green='\033[0;32m' | |
| NC='\033[0m' # No Color | |
| #Color=$RED | |
| Color=$Green | |
| printf "${Color} $ ${command}${NC}\n" | |
| eval $command |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1- change container_id in execdocker.sh

2- run
bash execdocker.sh "your_command"