Last active
September 9, 2017 15:06
-
-
Save eschen42/249dc9e205ceafee85b94f248320a7ad to your computer and use it in GitHub Desktop.
Run bash in a new or existing container
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/sh | |
# Run bash within an already-running container | |
# arg1 - ID or nickname of a running container | |
if [ "'${COLUMNS}x'" = "'x'" ]; then | |
echo Please 'export COLUMNS' before running this script. | |
else | |
sudo docker exec -ti $1 bash -c "export TERM=xterm; export COLUMNS=$COLUMNS; /bin/bash" | |
fi |
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/sh | |
# Run a container and remove the volume when it exits | |
# arg1 - name or name:tag of an image | |
if [ "'${COLUMNS}x'" = "'x'" ]; then | |
echo Please 'export COLUMNS' before running this script. | |
else | |
sudo docker run --rm -ti $1 bash -c "export TERM=xterm; export COLUMNS=$COLUMNS; /bin/bash" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment