Skip to content

Instantly share code, notes, and snippets.

@llaughlin
Created June 17, 2015 18:29
Show Gist options
  • Save llaughlin/c0d6d414b82ce606ddf3 to your computer and use it in GitHub Desktop.
Save llaughlin/c0d6d414b82ce606ddf3 to your computer and use it in GitHub Desktop.
MacOSX docker-enter docker instances
#!/bin/bash
set -e
# Check for nsenter. If not found, install it
boot2docker ssh '[ -f /var/lib/boot2docker/nsenter ] || docker run --rm -v /var/lib/boot2docker/:/target jpetazzo/nsenter'
# Use bash if no command is specified
args=$@
if [[ $# = 1 ]]; then
args+=(/bin/bash)
fi
boot2docker ssh -t sudo /var/lib/boot2docker/docker-enter "${args[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment