Last active
May 25, 2021 19:34
-
-
Save hershkoy/7d5a2c3c45f6233660bbbfe534073a4b to your computer and use it in GitHub Desktop.
docker exec/ssh into container by the row number in docker ps -a
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 | |
ln="$1" | |
containername=`docker ps --format "{{.Names}}" | awk "FNR == $1"` | |
echo $containername | |
docker exec -it $containername bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment