Last active
April 5, 2022 18:21
-
-
Save alvery/c8730ef936ad2fc98bfd63f66b5fe0a8 to your computer and use it in GitHub Desktop.
Easily attach to any docker container with choice. Put the script below in /usr/bin/dcattach chmod +x /usr/bin/dcattach
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 | |
containers=($(sudo docker ps --format '{{.Names}}' | sort)); | |
select container in "${containers[@]}"; do | |
[ -z "$container" ] || sudo docker exec -it $container /bin/sh -c \ | |
"[ -x /bin/bash ] && /bin/bash || /bin/sh"; | |
break; done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment