diff --git a/Dockerfile b/Dockerfile index 80053c7..8392260 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # The Docker Image is part of Pdocker project. The image is the baseline. This image can/should be modified according to personal user. -# Version 1.1.0 +# Version 1.1.1 # Use an official debian runtime as a parent image FROM debian diff --git a/README.md b/README.md index b87f529..aa33750 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Pdocker v1.1.0 +# Pdocker v1.1.1 Pdocker is a simple terminal UI to maintain and manage personal projects in Docker. diff --git a/build.sh b/build.sh index 03d4fd5..bb9171f 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ # Building the Docker Image for Pdocker project. -# Version 1.1.0 +# Version 1.1.1 echo "[*] Start Building..." # Build the image @@ -8,10 +8,10 @@ sudo docker build \ -t pdocker . # Add the alias to bashrc -echo "# Pdocker alias" >> ~/.profile +echo "# Pdocker alias" >> ~/.bash_profile # Add -v ~/hostpath/Projects:/Projects to share volume -echo "alias pdocker=`pwd`/pdocker.sh" >> ~/.profile -source ~/.profile +echo "alias pdocker=`pwd`/pdocker.sh" >> ~/.bash_profile +source ~/.bash_profile echo "[*] Image Building Complete." echo "[*] Use pdocker to start the enviroment. Enjoy." \ No newline at end of file diff --git a/pdocker.sh b/pdocker.sh index 4cf5ae0..7ce162e 100755 --- a/pdocker.sh +++ b/pdocker.sh @@ -1,5 +1,5 @@ # The Bash script is to manage and maintain the pdocker enviroment with docker. -# Version 1.1.0 +# Version 1.1.1 # Gloabl Variables pdockercontainers=$(docker ps -a | grep pdocker | awk -F ' ' '{print ($NF ":" $1)}' | tr ',', '\n') @@ -73,18 +73,20 @@ get_volume(){ read -p ">>" volumepath - if [[ $volumepath == "y" ]]; then - volume="--volume $(pwd):/home/$name" - elif [[ $volumepath != "n" ]]; then - volume="--volume $volumepath:/home/$name" - fi } # create_new_container creates new docker container create_new_container(){ get_name get_volume - docker run --name $name $volume -t -i pdocker /bin/bash + + #move to here as pwd passed form string dosn't work. + if [[ $volumepath == "y" ]]; then + docker run --name $name --volume "$(pwd)":/home/$name -t -i pdocker /bin/bash + elif [[ $volumepath != "n" ]]; then + volume="--volume $volumepath:/home/$name" + docker run --name $name $volume -t -i pdocker /bin/bash + fi } # check_containers check if there is existing containers.