Skip to content

Instantly share code, notes, and snippets.

@albertmatyi
Last active January 10, 2018 14:05
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save albertmatyi/9438d9ea9ae2d287e75181e81f2204fa to your computer and use it in GitHub Desktop.
Save albertmatyi/9438d9ea9ae2d287e75181e81f2204fa to your computer and use it in GitHub Desktop.
Open a bash in local docker instance aka. "ssh into local docker instance"
#!/bin/bash -xe
# docker id might be given as a parameter
DID=$1
if [[ "$DID" == "" ]]; then
# if no id given simply just connect to the first running instance
DID=$(docker ps | grep -Eo "^[0-9a-z]{8,}\b")
fi
docker exec -i -t $DID bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment