docker-source.sh raw

   1  #!/bin/bash
   2  #!/bin/bash [ HOW TO RUN: `source docker-source.sh` ] #NOPRINT
   3  export NAME="docker-pod" #NOPRINT
   4  export DATADIR="`pwd`" #NOPRINT
   5  # source $DATADIR/config #NOPRINT
   6  echo "Loading command aliases... Type 'halp' to see available commands" #NOPRINT
   7  ### HALP! How to control your $NAME docker container
   8  alias      dkr="sudo docker"
   9           ### [ shortcut to run docker with sudo ]
  10  alias   .where="echo $DATADIR"
  11           ### [ show where the current instance activated by init.sh lives ]
  12  alias      .cd="cd $DATADIR"
  13           ### [ change working directory to instance folder ]
  14  alias     .run="sudo docker run --network=\"host\" -v $DATADIR/data:/root/.parallelcoin -d=true -p 11047:11047 -p 11048:11048 -p 21047:21047 -p 21048:21048 --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined --name $NAME $NAME"
  15           ### [ start up the container (after building, to restart. for a'.stop'ed container, use '.start') ]
  16  alias   .start="sudo docker start $NAME"
  17           ### [ start the container that was previously '.stop'ed ]
  18  alias    .stop="sudo docker stop $NAME"
  19           ### [ stop the container, start it again with '.start' ]
  20  alias   .enter="sudo docker exec -it $NAME bash"
  21           ### [ open a shell inside the container ]
  22  alias     .log="sudo tail -f $DATADIR/data/debug.log"
  23           ### [ show the current output from the primary process in the container ]
  24  alias   .build="sudo docker build -t $NAME $DATADIR"
  25           ### [ build the container from the Dockerfile ]
  26  alias      .rm="sudo docker rm $NAME"
  27           ### [ remove the current container (for rebuilding) ]
  28  alias .editdkr="nano $DATADIR/Dockerfile"
  29           ### [ edit the Dockerfile ]
  30  alias  .editsh="nano $DATADIR/init.sh;source $DATADIR/init.sh"
  31           ### [ edit init.sh with nano then reload ]
  32  alias  halp="sed 's/\$NAME/$NAME/g' $DATADIR/init.sh|sed 's#\$DATADIR#$DATADIR#g'|grep -v NOPRINT|sed 's/alias //g'|sed 's/=\"/     \"/g'|sed 's/#/>/g'"
  33  ######### hit the 'q' key to exit help viewer <<<<<<<<<