Created
April 20, 2017 13:38
-
-
Save nathanl/35cdef3494f5012321dbbc5471bad910 to your computer and use it in GitHub Desktop.
A few tiny, useful Docker scripts, to be placed in one's `$PATH` and made executable
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 | |
# Shell into the Docker container with the given name. | |
# eg: `docker-bash my_app` | |
# Note: fails if more than one id is returned. | |
ID=$(docker-id $1) | |
docker exec -it $ID bash |
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 | |
# Output the id(s) of running Docker containers with the given name. | |
# eg: `docker-id my_app` | |
docker ps |grep $1 |cut -d' ' -f 1 |
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 | |
# Shell into the Docker container with the given name. | |
# eg: `docker-sh my_app` | |
# Note: fails if more than one id is returned. | |
ID=$(docker-id $1) | |
docker exec -it $ID sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment