#!/usr/bin/env bash declare image_name="$1" declare cont_name="$2" declare this_dir="$(realpath $(dirname "$0"))" if [ $# -lt 2 ]; then if [ $# -lt 1 ]; then declare image_name_cmd="$this_dir/docker_image_name.sh" image_name="$(eval $image_name_cmd)" fi declare cont_name_cmd="$this_dir/docker_container_name.sh" cont_name="$(eval $cont_name_cmd $image_name)" fi # The root repo path (`repo_path`) is mounted to `repo_path_out`. The latter is # stored in a separate variable for convenience. declare repo_path="$(cd .. && git rev-parse --show-toplevel && cd $this_dir)" declare repo_path_out=$repo_path # `working_dir` is the starting dir for all docker shells launched via # `docker exec -it bash`. declare working_dir=$repo_path_out docker run \ --rm \ --net host \ -h $(hostname) \ -e "TZ=America/New_York" \ --cap-add=SYS_PTRACE \ --security-opt seccomp=unconfined \ --name $cont_name \ -v $repo_path:$repo_path_out \ -u $(id -u $USER) \ -w $working_dir \ --shm-size=4024m \ -t \ -i \ -d \ -e DISPLAY="$DISPLAY" \ "$image_name" \ bash