Created
February 25, 2015 16:32
-
-
Save theothermattm/872c1619f1acd2b00033 to your computer and use it in GitHub Desktop.
Attach to a docker image by image name
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
# attaches to the first running docker container containing the name passed | |
# in as the first argument to the command | |
# example: attachto projects | |
function attachto () { | |
echo "Attaching to first running docker container with name: $1 You might need to press ctrl+c to start entering commands..." | |
docker attach $( docker ps | grep $1 | head -n 1 | cut -d' ' -f1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment