#!/bin/sh
IFS=$'\n'
echo $1
echo $2
case $2 in
attach) docker exec -it $(docker ps -a --no-trunc | grep $1 | awk '{print $1}') geth attach --datadir=/root/.ethereum/devchain
;;
log) docker exec -it $(docker ps -a --no-trunc | grep $1 | awk '{print $1}') tail -n 30 -f /root/geth.log
;;
sh) docker exec -it $(docker ps -a --no-trunc | grep $1 | awk '{print $1}') sh
;;
bash) docker exec -it $(docker ps -a --no-trunc | grep $1 | awk '{print $1}') bash
;;
*) echo "command parms1: docker container name"
echo "command parms2: attach (geth attach) or log (tail -n 30 -f) or sh or bash"
esac
ethereum docker geth shell for geth attach and tail log
Help use docker geth for geth attach and watch log. Geth Command line path need to change for yourself env.