Skip to content

Commit

Permalink
v1.1.1 Volume path and bash_profile fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Gurjant Singh authored and Gurjant Singh committed Jul 15, 2019
1 parent b45d87b commit 19abf52
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
8 changes: 4 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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."
16 changes: 9 additions & 7 deletions pdocker.sh
Original file line number Diff line number Diff line change
@@ -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')
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 19abf52

Please sign in to comment.