#!/bin/bash home_dir=$PWD echo $home_dir find . -type f -name Dockerfile | while read -r file_path; do dir_path=$(dirname "$file_path") file_name=$(echo $dir_path | cut -d'/' -f3- | sed 's|/|_|g') docker build -t "$file_name" $dir_path docker run -v `pwd`:/home/rublon-ssh/ $file_name /bin/bash /home/rublon-ssh/build_project.sh $file_name done