Skip to content

Commit 0a04df8

Browse files
committed
add --no-tty option
1 parent 10803a0 commit 0a04df8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

bin/docker-php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ composer_dir="-v ${COMPOSER_DIR}:/home/app/.composer"
99
directory="$(pwd)"
1010
extra_hosts="${EXTRA_HOSTS}"
1111
hosts=""
12+
tty="-t"
1213
name="php-docker-project-cli"
1314
network=""
1415
no_cache=""
@@ -38,6 +39,7 @@ Options:
3839
--build Build image from Dockerfile.
3940
--network NAME Name of network to connect the container to, e.g. traefik_webgateway.
4041
--no-cache Do not use cache when building the image.
42+
--no-tty Do not allocate a pseudo-TTY.
4143
--project-directory PATH Alternative working directory, default is current directory.
4244
--ssh-keys Mount user ssh directory."
4345
exit
@@ -65,6 +67,9 @@ for ((i=0; i < "$#"; ++i)); do
6567
--ssh-keys ) ssh_dir="-v ${HOME}/.ssh:/home/app/.ssh"
6668
unset "args[i]"
6769
;;
70+
--no-tty ) tty=""
71+
unset "args[i]"
72+
;;
6873
esac
6974
done
7075

@@ -120,4 +125,4 @@ if [[ -z "${hosts}" ]] && [[ -n "${extra_hosts}" ]]; then
120125
done
121126
fi
122127

123-
docker run -it --rm --name "${name}" ${hosts} -v "${volume}" ${network} ${ssh_dir} ${composer_dir} -w "${work_dir}" -u "${user}" "${image}" ${cmd} "${args[@]}"
128+
docker run -i ${tty} --rm --name "${name}" ${hosts} -v "${volume}" ${network} ${ssh_dir} ${composer_dir} -w "${work_dir}" -u "${user}" "${image}" ${cmd} "${args[@]}"

0 commit comments

Comments
 (0)