Created
January 3, 2015 16:35
-
-
Save NikoWoot/d654e044e139209b6bef to your computer and use it in GitHub Desktop.
Docker open new tty SOURCE : http://programster.blogspot.fr/2014/01/docker-enter-running-container.html
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
#!/bin/bash | |
EXPECTED_NUM_ARGS=1; | |
if [ "$#" -ne $EXPECTED_NUM_ARGS ]; then | |
# user didn't specify which container ID, assume the latest one | |
CONTAINER_ID=`/usr/bin/docker ps -q --no-trunc | /bin/sed -n 1p` | |
/usr/bin/docker exec -it $CONTAINER_ID bash | |
else | |
# enter the container the user specified | |
/usr/bin/docker exec -it $1 bash | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment