Skip to content

Instantly share code, notes, and snippets.

@twentythousandphantoms
Created September 24, 2019 16:06
Show Gist options
  • Save twentythousandphantoms/19f396ac54e460a085bc4d6a422c383d to your computer and use it in GitHub Desktop.
Save twentythousandphantoms/19f396ac54e460a085bc4d6a422c383d to your computer and use it in GitHub Desktop.
/bin/docker-enter
#!/bin/sh
CONTAINER="${1}"
SHELL="${2:-/bin/sh}"
if [ -z "${CONTAINER}" ]; then
echo "You have not provided the container name or id!"
docker ps --format "{{.Names}}"
exit $?
fi
docker exec -t -i "${CONTAINER}" "${SHELL}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment