From 8e976258b51ed6d9ce3708995030e1dab09e767c Mon Sep 17 00:00:00 2001 From: milhu Date: Fri, 8 May 2015 11:21:02 +0800 Subject: [PATCH] Update .bashrc_docker for CentOS usage resolve invalid option error and able to find nsenter automatically if it has been installed with path notified --- _local/.bashrc_docker | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_local/.bashrc_docker b/_local/.bashrc_docker index fb4e76d..ed0df3c 100644 --- a/_local/.bashrc_docker +++ b/_local/.bashrc_docker @@ -7,11 +7,15 @@ alias docker-ip="sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' #the implementation refs from https://github.com/jpetazzo/nsenter/blob/master/docker-enter function docker-enter() { - if [ -e $(dirname "$0")/nsenter ]; then + #if [ -e $(dirname "$0")/nsenter ]; then + #Change for centos bash running + if [ -e $(dirname '$0')/nsenter ]; then # with boot2docker, nsenter is not in the PATH but it is in the same folder NSENTER=$(dirname "$0")/nsenter else - NSENTER=nsenter + # if nsenter has already been installed with path notified, here will be clarified + NSENTER=$(which nsenter) + #NSENTER=nsenter fi [ -z "$NSENTER" ] && echo "WARN Cannot find nsenter" && return