Instantly share code, notes, and snippets.

Embed
What would you like to do?
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