Skip to content

Instantly share code, notes, and snippets.

@abraverm
Created February 17, 2015 10:31
Show Gist options
  • Select an option

  • Save abraverm/446f5f3c963e64b44722 to your computer and use it in GitHub Desktop.

Select an option

Save abraverm/446f5f3c963e64b44722 to your computer and use it in GitHub Desktop.
Run commands and enter Docker conatiner without using SSH: $ cmd_docker <CONTAINER NAME> /bin/bash
#!/bin/bash
CONTAINER=$1
COMMAND=$2
ID=`docker inspect --format '{{ .State.Pid }}' $CONTAINER`
sudo nsenter -m -u -n -i -p -t $ID $COMMAND
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment