Skip to content

Commit

Permalink
add container to network
Browse files Browse the repository at this point in the history
  • Loading branch information
devosc committed Feb 22, 2020
1 parent 1cad74a commit 8f92764
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/docker-php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ directory="$(pwd)"
extra_hosts="${EXTRA_HOSTS}"
hosts=""
name="php-docker-project-cli"
network=""
no_cache=""
ssh_dir=""
tag="latest"
Expand All @@ -35,6 +36,7 @@ Commands:
Options:
--add-host list Add custom host-to-IP mapping, e.g example.com:192.168.10.10.
--build Build image from Dockerfile.
--network NAME Name of network to connect the container to, e.g. traefik_webgateway.
--no-cache Do not use cache when building the image.
--project-directory PATH Alternative working directory, default is current directory.
--ssh-keys Mount user ssh directory."
Expand All @@ -54,6 +56,9 @@ for ((i=0; i < "$#"; ++i)); do
unset "args[i]" "args[i+1]"
i=$(expr ${i} + 1)
;;
--network ) network="--network ${args[i+1]}"
unset "args[i]" "args[i+1]"
;;
--no-cache ) no_cache="--no-cache"
unset "args[i]"
;;
Expand Down Expand Up @@ -115,4 +120,4 @@ if [[ -z "${hosts}" ]] && [[ -n "${extra_hosts}" ]]; then
done
fi

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

0 comments on commit 8f92764

Please sign in to comment.