From 466192f5cfbb6dbd5e7f046316bd5a40d881b980 Mon Sep 17 00:00:00 2001 From: Denperidge Date: Tue, 3 Jan 2023 18:41:01 +0100 Subject: [PATCH 1/5] Updated Ubuntu 21.04 to 22.04, python2 to python3 Building the image using 21.04 seems to no longer be possible due to deprecated repositories Thanks to @madnificent & @Riadabd ! --- Dockerfile | 4 ++-- templates/Dockerfile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 084a864..71da374 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -FROM ubuntu:21.04 +FROM ubuntu:22.04 LABEL maintainer="Aad Versteden " # Install nodejs as per http://askubuntu.com/questions/672994/how-to-install-nodejs-4-on-ubuntu-15-04-64-bit-edition -RUN export DEBIAN_FRONTEND=noninteractive; apt-get -y update; apt-get -y install wget python build-essential git libfontconfig curl rsync +RUN export DEBIAN_FRONTEND=noninteractive; apt-get -y update; apt-get -y install wget python3 build-essential git libfontconfig curl rsync RUN wget -qO- https://deb.nodesource.com/setup_16.x > node_setup.sh RUN bash node_setup.sh RUN apt-get -y install nodejs diff --git a/templates/Dockerfile b/templates/Dockerfile index c1297f4..c3a00d9 100644 --- a/templates/Dockerfile +++ b/templates/Dockerfile @@ -1,8 +1,8 @@ -FROM ubuntu:21.04 +FROM ubuntu:22.04 LABEL maintainer="Aad Versteden " # Install nodejs as per http://askubuntu.com/questions/672994/how-to-install-nodejs-4-on-ubuntu-15-04-64-bit-edition -RUN export DEBIAN_FRONTEND=noninteractive; apt-get -y update; apt-get -y install wget python build-essential git libfontconfig curl rsync +RUN export DEBIAN_FRONTEND=noninteractive; apt-get -y update; apt-get -y install wget python3 build-essential git libfontconfig curl rsync RUN wget -qO- https://deb.nodesource.com/setup_16.x > node_setup.sh RUN bash node_setup.sh RUN apt-get -y install nodejs From 58a1095c4fa88d71539bc7bd7bff122c51488f63 Mon Sep 17 00:00:00 2001 From: Denperidge Date: Tue, 3 Jan 2023 19:33:44 +0100 Subject: [PATCH 2/5] Updated support-scripts edi_docker_host_option - linux selector now uses a wildcard - Added prompt for when dockerhost can't be automatically determined the prompt will work both for other OS's, as well as when the linux/darwin docker host IP getting fails Thanks to @madnificent for the help! --- bin/ed | 16 ++++++++++++---- bin/edi | 16 ++++++++++++---- bin/eds | 16 ++++++++++++---- support-scripts | 16 ++++++++++++---- 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/bin/ed b/bin/ed index 4818624..9401606 100755 --- a/bin/ed +++ b/bin/ed @@ -222,7 +222,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] + if [[ "$OSTYPE" == "linux"* ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -230,9 +230,17 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - else - echo "OS TYPE $OSTYPE not understood" - exit 1 + fi + + if [ -z "$DOCKERHOST" ] + then + # Normally echos would be used to not have all the info on one line in read -p, + # but considering that echo is used to build the command, that is not possible here. + default="172.17.0.1" + read -p $'Docker host could not be determined + Please manually enter the IP of your docker0 bridge connection + docker0 ip '"[$default]: " DOCKERHOST + DOCKERHOST=${DOCKERHOST:-$default} fi echo "--add-host host:$DOCKERHOST " } diff --git a/bin/edi b/bin/edi index 36f15e6..af79912 100755 --- a/bin/edi +++ b/bin/edi @@ -220,7 +220,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] + if [[ "$OSTYPE" == "linux"* ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -228,9 +228,17 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - else - echo "OS TYPE $OSTYPE not understood" - exit 1 + fi + + if [ -z "$DOCKERHOST" ] + then + # Normally echos would be used to not have all the info on one line in read -p, + # but considering that echo is used to build the command, that is not possible here. + default="172.17.0.1" + read -p $'Docker host could not be determined + Please manually enter the IP of your docker0 bridge connection + docker0 ip '"[$default]: " DOCKERHOST + DOCKERHOST=${DOCKERHOST:-$default} fi echo "--add-host host:$DOCKERHOST " } diff --git a/bin/eds b/bin/eds index 758dfc8..53baacf 100755 --- a/bin/eds +++ b/bin/eds @@ -220,7 +220,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] + if [[ "$OSTYPE" == "linux"* ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -228,9 +228,17 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - else - echo "OS TYPE $OSTYPE not understood" - exit 1 + fi + + if [ -z "$DOCKERHOST" ] + then + # Normally echos would be used to not have all the info on one line in read -p, + # but considering that echo is used to build the command, that is not possible here. + default="172.17.0.1" + read -p $'Docker host could not be determined + Please manually enter the IP of your docker0 bridge connection + docker0 ip '"[$default]: " DOCKERHOST + DOCKERHOST=${DOCKERHOST:-$default} fi echo "--add-host host:$DOCKERHOST " } diff --git a/support-scripts b/support-scripts index 8d7a2f5..674d1b6 100644 --- a/support-scripts +++ b/support-scripts @@ -206,7 +206,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] + if [[ "$OSTYPE" == "linux"* ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -214,9 +214,17 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - else - echo "OS TYPE $OSTYPE not understood" - exit 1 + fi + + if [ -z "$DOCKERHOST" ] + then + # Normally echos would be used to not have all the info on one line in read -p, + # but considering that echo is used to build the command, that is not possible here. + default="172.17.0.1" + read -p $'Docker host could not be determined + Please manually enter the IP of your docker0 bridge connection + docker0 ip '"[$default]: " DOCKERHOST + DOCKERHOST=${DOCKERHOST:-$default} fi echo "--add-host host:$DOCKERHOST " } From 77d9eda6c362154506c84ca35182368fbbeed9f0 Mon Sep 17 00:00:00 2001 From: Denperidge Date: Fri, 14 Apr 2023 11:12:20 +0200 Subject: [PATCH 3/5] Undo bin changes for PR #34 --- bin/ed | 16 ++++------------ bin/edi | 16 ++++------------ bin/eds | 16 ++++------------ 3 files changed, 12 insertions(+), 36 deletions(-) diff --git a/bin/ed b/bin/ed index 9401606..4818624 100755 --- a/bin/ed +++ b/bin/ed @@ -222,7 +222,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux"* ]] + if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -230,17 +230,9 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - fi - - if [ -z "$DOCKERHOST" ] - then - # Normally echos would be used to not have all the info on one line in read -p, - # but considering that echo is used to build the command, that is not possible here. - default="172.17.0.1" - read -p $'Docker host could not be determined - Please manually enter the IP of your docker0 bridge connection - docker0 ip '"[$default]: " DOCKERHOST - DOCKERHOST=${DOCKERHOST:-$default} + else + echo "OS TYPE $OSTYPE not understood" + exit 1 fi echo "--add-host host:$DOCKERHOST " } diff --git a/bin/edi b/bin/edi index af79912..36f15e6 100755 --- a/bin/edi +++ b/bin/edi @@ -220,7 +220,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux"* ]] + if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -228,17 +228,9 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - fi - - if [ -z "$DOCKERHOST" ] - then - # Normally echos would be used to not have all the info on one line in read -p, - # but considering that echo is used to build the command, that is not possible here. - default="172.17.0.1" - read -p $'Docker host could not be determined - Please manually enter the IP of your docker0 bridge connection - docker0 ip '"[$default]: " DOCKERHOST - DOCKERHOST=${DOCKERHOST:-$default} + else + echo "OS TYPE $OSTYPE not understood" + exit 1 fi echo "--add-host host:$DOCKERHOST " } diff --git a/bin/eds b/bin/eds index 53baacf..758dfc8 100755 --- a/bin/eds +++ b/bin/eds @@ -220,7 +220,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux"* ]] + if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -228,17 +228,9 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - fi - - if [ -z "$DOCKERHOST" ] - then - # Normally echos would be used to not have all the info on one line in read -p, - # but considering that echo is used to build the command, that is not possible here. - default="172.17.0.1" - read -p $'Docker host could not be determined - Please manually enter the IP of your docker0 bridge connection - docker0 ip '"[$default]: " DOCKERHOST - DOCKERHOST=${DOCKERHOST:-$default} + else + echo "OS TYPE $OSTYPE not understood" + exit 1 fi echo "--add-host host:$DOCKERHOST " } From 1a6cb5e2b096431e1682902e708c08d76bd54998 Mon Sep 17 00:00:00 2001 From: Denperidge Date: Tue, 3 Jan 2023 19:33:44 +0100 Subject: [PATCH 4/5] Updated support-scripts edi_docker_host_option - linux selector now uses a wildcard - Added prompt for when dockerhost can't be automatically determined the prompt will work both for other OS's, as well as when the linux/darwin docker host IP getting fails Thanks to @madnificent for the help! --- bin/ed | 16 ++++++++++++---- bin/edi | 16 ++++++++++++---- bin/eds | 16 ++++++++++++---- support-scripts | 16 ++++++++++++---- 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/bin/ed b/bin/ed index 4818624..9401606 100755 --- a/bin/ed +++ b/bin/ed @@ -222,7 +222,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] + if [[ "$OSTYPE" == "linux"* ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -230,9 +230,17 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - else - echo "OS TYPE $OSTYPE not understood" - exit 1 + fi + + if [ -z "$DOCKERHOST" ] + then + # Normally echos would be used to not have all the info on one line in read -p, + # but considering that echo is used to build the command, that is not possible here. + default="172.17.0.1" + read -p $'Docker host could not be determined + Please manually enter the IP of your docker0 bridge connection + docker0 ip '"[$default]: " DOCKERHOST + DOCKERHOST=${DOCKERHOST:-$default} fi echo "--add-host host:$DOCKERHOST " } diff --git a/bin/edi b/bin/edi index 36f15e6..af79912 100755 --- a/bin/edi +++ b/bin/edi @@ -220,7 +220,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] + if [[ "$OSTYPE" == "linux"* ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -228,9 +228,17 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - else - echo "OS TYPE $OSTYPE not understood" - exit 1 + fi + + if [ -z "$DOCKERHOST" ] + then + # Normally echos would be used to not have all the info on one line in read -p, + # but considering that echo is used to build the command, that is not possible here. + default="172.17.0.1" + read -p $'Docker host could not be determined + Please manually enter the IP of your docker0 bridge connection + docker0 ip '"[$default]: " DOCKERHOST + DOCKERHOST=${DOCKERHOST:-$default} fi echo "--add-host host:$DOCKERHOST " } diff --git a/bin/eds b/bin/eds index 758dfc8..53baacf 100755 --- a/bin/eds +++ b/bin/eds @@ -220,7 +220,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] + if [[ "$OSTYPE" == "linux"* ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -228,9 +228,17 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - else - echo "OS TYPE $OSTYPE not understood" - exit 1 + fi + + if [ -z "$DOCKERHOST" ] + then + # Normally echos would be used to not have all the info on one line in read -p, + # but considering that echo is used to build the command, that is not possible here. + default="172.17.0.1" + read -p $'Docker host could not be determined + Please manually enter the IP of your docker0 bridge connection + docker0 ip '"[$default]: " DOCKERHOST + DOCKERHOST=${DOCKERHOST:-$default} fi echo "--add-host host:$DOCKERHOST " } diff --git a/support-scripts b/support-scripts index 8d7a2f5..674d1b6 100644 --- a/support-scripts +++ b/support-scripts @@ -206,7 +206,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] + if [[ "$OSTYPE" == "linux"* ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -214,9 +214,17 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - else - echo "OS TYPE $OSTYPE not understood" - exit 1 + fi + + if [ -z "$DOCKERHOST" ] + then + # Normally echos would be used to not have all the info on one line in read -p, + # but considering that echo is used to build the command, that is not possible here. + default="172.17.0.1" + read -p $'Docker host could not be determined + Please manually enter the IP of your docker0 bridge connection + docker0 ip '"[$default]: " DOCKERHOST + DOCKERHOST=${DOCKERHOST:-$default} fi echo "--add-host host:$DOCKERHOST " } From 2cc22b5c6029d06831326caae76ec0aef65cab1b Mon Sep 17 00:00:00 2001 From: Denperidge Date: Fri, 14 Apr 2023 11:12:20 +0200 Subject: [PATCH 5/5] Undo bin changes for PR #34 --- bin/ed | 16 ++++------------ bin/edi | 16 ++++------------ bin/eds | 16 ++++------------ 3 files changed, 12 insertions(+), 36 deletions(-) diff --git a/bin/ed b/bin/ed index 9401606..4818624 100755 --- a/bin/ed +++ b/bin/ed @@ -222,7 +222,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux"* ]] + if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -230,17 +230,9 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - fi - - if [ -z "$DOCKERHOST" ] - then - # Normally echos would be used to not have all the info on one line in read -p, - # but considering that echo is used to build the command, that is not possible here. - default="172.17.0.1" - read -p $'Docker host could not be determined - Please manually enter the IP of your docker0 bridge connection - docker0 ip '"[$default]: " DOCKERHOST - DOCKERHOST=${DOCKERHOST:-$default} + else + echo "OS TYPE $OSTYPE not understood" + exit 1 fi echo "--add-host host:$DOCKERHOST " } diff --git a/bin/edi b/bin/edi index af79912..36f15e6 100755 --- a/bin/edi +++ b/bin/edi @@ -220,7 +220,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux"* ]] + if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -228,17 +228,9 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - fi - - if [ -z "$DOCKERHOST" ] - then - # Normally echos would be used to not have all the info on one line in read -p, - # but considering that echo is used to build the command, that is not possible here. - default="172.17.0.1" - read -p $'Docker host could not be determined - Please manually enter the IP of your docker0 bridge connection - docker0 ip '"[$default]: " DOCKERHOST - DOCKERHOST=${DOCKERHOST:-$default} + else + echo "OS TYPE $OSTYPE not understood" + exit 1 fi echo "--add-host host:$DOCKERHOST " } diff --git a/bin/eds b/bin/eds index 53baacf..758dfc8 100755 --- a/bin/eds +++ b/bin/eds @@ -220,7 +220,7 @@ edi_does_container_exist() { } edi_docker_host_option() { - if [[ "$OSTYPE" == "linux"* ]] + if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux" ]] then # Linux DOCKERHOST=`ip addr show docker0 | grep inet | head -n 1 | awk '{ print $2 }' | grep -oP "^[^/]+"` @@ -228,17 +228,9 @@ edi_docker_host_option() { # Mac OSX # Solution found via https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach DOCKERHOST=$(ifconfig | grep -E "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d: | head -n1) - fi - - if [ -z "$DOCKERHOST" ] - then - # Normally echos would be used to not have all the info on one line in read -p, - # but considering that echo is used to build the command, that is not possible here. - default="172.17.0.1" - read -p $'Docker host could not be determined - Please manually enter the IP of your docker0 bridge connection - docker0 ip '"[$default]: " DOCKERHOST - DOCKERHOST=${DOCKERHOST:-$default} + else + echo "OS TYPE $OSTYPE not understood" + exit 1 fi echo "--add-host host:$DOCKERHOST " }