n=0
while :
do
docker pull $2 \
&& docker tag $2 $1$2 \
&& docker push $1$2 && break # substitute your command here
n=$((n+1))
if [ $n ge 2 ]; then
echo "initialise failed"
exit 1
fi
echo "retrying..$n"
sleep 1
done