From 74ea2aec503fa6bce33ededc3c42a10fdb546e8f Mon Sep 17 00:00:00 2001 From: Tyler Jewell Date: Thu, 4 Aug 2016 11:44:23 -0700 Subject: [PATCH] Fixes infinite loop on windows (#2049) * Fixes infinite loop on windows * fixed missing data folder output --- Vagrantfile | 448 ++++++++++----------- che.sh | 55 ++- dockerfiles/che-launcher/launcher_funcs.sh | 7 +- 3 files changed, 274 insertions(+), 236 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 4521c2b5f9..a321590f04 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,224 +1,224 @@ -# Copyright (c) 2012-2016 Codenvy, S.A. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Codenvy, S.A. - initial API and implementation - -# Set to "://:@:" -$http_proxy = ENV['HTTP_PROXY'] || "" -$https_proxy = ENV['HTTPS_PROXY'] || "" -$no_proxy = ENV['NO_PROXY'] || "localhost,127.0.0.1" -$che_version = ENV['CHE_VERSION'] || "latest" -$ip = ENV['CHE_IP'] || "192.168.28.100" -$hostPort = (ENV['CHE_PORT'] || 8080).to_i -$containerPort = (ENV['CHE_CONTAINER_PORT'] || ($hostPort == -1 ? 8080 : $hostPort)).to_i -$user_data = ENV['CHE_DATA'] || "." -$vm_name = ENV['CHE_VM_NAME'] || "eclipse-che-vm" -$provisionProgress = ENV['PROVISION_PROGRESS'] || "basic" - -Vagrant.configure(2) do |config| - puts ("ECLIPSE CHE: VAGRANT INSTALLER") - puts ("ECLIPSE CHE: REQUIRED: VIRTUALBOX 5.x") - puts ("ECLIPSE CHE: REQUIRED: VAGRANT 1.8.x") - puts ("") - if ($http_proxy.to_s != '' || $https_proxy.to_s != '') && !Vagrant.has_plugin?("vagrant-proxyconf") - puts ("You configured a proxy, but Vagrant's proxy plugin not detected.") - puts ("Install the plugin with: vagrant plugin install vagrant-proxyconf") - Process.kill 9, Process.pid - end - - if Vagrant.has_plugin?("vagrant-proxyconf") - config.proxy.http = $http_proxy - config.proxy.https = $https_proxy - config.proxy.no_proxy = $no_proxy - end - - config.vm.box = "boxcutter/centos72-docker" - config.vm.box_download_insecure = true - config.ssh.insert_key = false - if $ip.to_s.downcase == "dhcp" - config.vm.network :private_network, type: "dhcp" - else - config.vm.network :private_network, ip: $ip - end - if $hostPort != -1 - config.vm.network "forwarded_port", guest: $containerPort, host: $hostPort - end - config.vm.synced_folder $user_data, "/home/user/che" - config.vm.define "che" do |che| - end - - config.vm.provider "virtualbox" do |vb| - vb.memory = "4096" - vb.name = $vm_name - end - - $script = <<-'SHELL' - HTTP_PROXY=$1 - HTTPS_PROXY=$2 - NO_PROXY=$3 - CHE_VERSION=$4 - IP=$5 - PORT=$6 - PROVISION_PROGRESS=$7 - - if [ "${IP,,}" = "dhcp" ]; then - echo "----------------------------------------" - echo "ECLIPSE CHE: CHECKING DYNAMIC IP ADDRESS" - echo "----------------------------------------" - DEV=$(grep -l "VAGRANT-BEGIN" /etc/sysconfig/network-scripts/ifcfg-*|xargs grep "DEVICE="|sort|tail -1|cut -d "=" -f 2) - if [ -z "${DEV}" ]; then - >&2 echo "Unable to find DHCP network device" - exit 1 - fi - IP=$(ip addr show dev ${DEV} | sed -r -e '/inet [0-9]/!d;s/^[[:space:]]*inet ([^[:space:]/]+).*$/\1/') - if [ -z "${IP}" ]; then - >&2 echo "Unable to find DHCP network ip" - exit 1 - fi - echo "IP: ${IP}" - echo - fi - - if [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then - echo "-------------------------------------" - echo "." - echo "ECLIPSE CHE: CONFIGURING SYSTEM PROXY" - echo "." - echo "-------------------------------------" - echo 'export HTTP_PROXY="'$HTTP_PROXY'"' >> /home/vagrant/.bashrc - echo 'export HTTPS_PROXY="'$HTTPS_PROXY'"' >> /home/vagrant/.bashrc - source /home/vagrant/.bashrc - - # Configuring the Che properties file - mounted into Che container when it starts - echo 'http.proxy="'$HTTP_PROXY'"' >> /home/user/che/conf/che.properties - echo 'https.proxy="'$HTTPS_PROXY'"' >> /home/user/che/conf/che.properties - - echo "HTTP PROXY set to: $HTTP_PROXY" - echo "HTTPS PROXY set to: $HTTPS_PROXY" - fi - - function perform - { - local progress=$1 - local command=$2 - shift 2 - - local pid="" - - case "$progress" in - extended) - # simulate tty environment to get full output of progress bars and percentages - printf "set timeout -1\nspawn %s\nexpect eof" "$command $*" | expect -f - - ;; - basic|*) - $command "$@" &>/dev/null & - pid=$! - while kill -0 "$pid" >/dev/null 2>&1; do - printf "#" - sleep 10 - done - wait $pid # return pid's exit code - ;; - esac - } - - echo "------------------------------------" - echo "ECLIPSE CHE: UPGRADING DOCKER ENGINE" - echo "------------------------------------" - if [ "$PROVISION_PROGRESS" = "extended" ]; then - # we sacrifice a few seconds of additional install time for much better progress afterwards - perform basic yum -y install expect - fi - perform $PROVISION_PROGRESS sudo yum -y update docker-engine - - echo $(docker --version) - - # Add the 'vagrant' user to the 'docker' group - usermod -aG docker vagrant &>/dev/null - - # We need write access to this file to enable Che container to create other containers - sudo chmod 777 /var/run/docker.sock &>/dev/null - - # Setup the overlay storage driver to eliminate errors - sudo sed -i '/ExecStart=\/usr\/bin\/dockerd/c\ExecStart=\/usr\/bin\/dockerd --storage-driver=overlay' /lib/systemd/system/docker.service - - # Configure Docker daemon with the proxy - if [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then - mkdir /etc/systemd/system/docker.service.d - fi - if [ -n "$HTTP_PROXY" ]; then - printf "[Service]\nEnvironment=\"HTTP_PROXY=${HTTP_PROXY}\"" > /etc/systemd/system/docker.service.d/http-proxy.conf - printf "" - fi - if [ -n "$HTTPS_PROXY" ]; then - printf "[Service]\nEnvironment=\"HTTPS_PROXY=${HTTPS_PROXY}\"" > /etc/systemd/system/docker.service.d/https-proxy.conf - fi - if [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then - printf "[Service]\nEnvironment=\"NO_PROXY=${NO_PROXY}\"" > /etc/systemd/system/docker.service.d/no-proxy.conf - fi - - systemctl daemon-reload - systemctl restart docker - - echo "--------------------------------------------------" - echo "ECLIPSE CHE: DOWNLOADING ECLIPSE CHE DOCKER IMAGES" - echo "--------------------------------------------------" - perform $PROVISION_PROGRESS docker pull codenvy/che-launcer:${CHE_VERSION} - perform $PROVISION_PROGRESS docker pull codenvy/che-server:${CHE_VERSION} - - echo "--------------------------------" - echo "ECLIPSE CHE: BOOTING ECLIPSE CHE" - echo "--------------------------------" - curl -sL https://raw.githubusercontent.com/eclipse/che/master/che.sh | tr -d '\15\32' > /home/vagrant/che.sh - chmod +x /home/vagrant/che.sh - export CHE_CONF_FOLDER=/home/user/che/conf/ - export CHE_PORT=${PORT} - export CHE_VERSION=${CHE_VERSION} - export CHE_HOST_IP=172.17.0.1 - export CHE_HOSTNAME=${CHE_IP} - /home/vagrant/che.sh start - -# docker run --net=host --name=che --restart=always --detach ` -# `-v /var/run/docker.sock:/var/run/docker.sock ` -# `-v /home/user/che/lib:/home/user/che/lib-copy ` -# `-v /home/user/che/workspaces:/home/user/che/workspaces ` -# `-v /home/user/che/storage:/home/user/che/storage ` -# `-v /home/user/che/conf:/container ` -# `-e CHE_LOCAL_CONF_DIR=/container ` -# `codenvy/che:${CHE_VERSION} --remote:${IP} --port:${PORT} run &>/dev/null - SHELL - - config.vm.provision "shell" do |s| - s.inline = $script - s.args = [$http_proxy, $https_proxy, $no_proxy, $che_version, $ip, $containerPort, $provisionProgress] - end - - $script2 = <<-'SHELL' - IP=$1 - PORT=$2 - MAPPED_PORT=$3 - - if [ "${IP,,}" = "dhcp" ]; then - DEV=$(grep -l "VAGRANT-BEGIN" /etc/sysconfig/network-scripts/ifcfg-*|xargs grep "DEVICE="|sort|tail -1|cut -d "=" -f 2) - IP=$(ip addr show dev ${DEV} | sed -r -e '/inet [0-9]/!d;s/^[[:space:]]*inet ([^[:space:]/]+).*$/\1/') - fi - - rm -f /home/user/che/.che_url - rm -f /home/user/che/.che_host_port - CHE_URL="http://${IP}:${PORT}" - - echo "${CHE_URL}" > /home/user/che/.che_url - echo "${MAPPED_PORT}" > /home/user/che/.che_host_port - - SHELL - - config.vm.provision "shell", run: "always" do |s| - s.inline = $script2 - s.args = [$ip, $containerPort, $hostPort] - end - -end +# Copyright (c) 2012-2016 Codenvy, S.A. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Codenvy, S.A. - initial API and implementation + +# Set to "://:@:" +$http_proxy = ENV['HTTP_PROXY'] || "" +$https_proxy = ENV['HTTPS_PROXY'] || "" +$no_proxy = ENV['NO_PROXY'] || "localhost,127.0.0.1" +$che_version = ENV['CHE_VERSION'] || "latest" +$ip = ENV['CHE_IP'] || "192.168.28.100" +$hostPort = (ENV['CHE_PORT'] || 8080).to_i +$containerPort = (ENV['CHE_CONTAINER_PORT'] || ($hostPort == -1 ? 8080 : $hostPort)).to_i +$user_data = ENV['CHE_DATA'] || "." +$vm_name = ENV['CHE_VM_NAME'] || "eclipse-che-vm" +$provisionProgress = ENV['PROVISION_PROGRESS'] || "basic" + +Vagrant.configure(2) do |config| + puts ("ECLIPSE CHE: VAGRANT INSTALLER") + puts ("ECLIPSE CHE: REQUIRED: VIRTUALBOX 5.x") + puts ("ECLIPSE CHE: REQUIRED: VAGRANT 1.8.x") + puts ("") + if ($http_proxy.to_s != '' || $https_proxy.to_s != '') && !Vagrant.has_plugin?("vagrant-proxyconf") + puts ("You configured a proxy, but Vagrant's proxy plugin not detected.") + puts ("Install the plugin with: vagrant plugin install vagrant-proxyconf") + Process.kill 9, Process.pid + end + + if Vagrant.has_plugin?("vagrant-proxyconf") + config.proxy.http = $http_proxy + config.proxy.https = $https_proxy + config.proxy.no_proxy = $no_proxy + end + + config.vm.box = "boxcutter/centos72-docker" + config.vm.box_download_insecure = true + config.ssh.insert_key = false + if $ip.to_s.downcase == "dhcp" + config.vm.network :private_network, type: "dhcp" + else + config.vm.network :private_network, ip: $ip + end + if $hostPort != -1 + config.vm.network "forwarded_port", guest: $containerPort, host: $hostPort + end + config.vm.synced_folder $user_data, "/home/user/che" + config.vm.define "che" do |che| + end + + config.vm.provider "virtualbox" do |vb| + vb.memory = "4096" + vb.name = $vm_name + end + + $script = <<-'SHELL' + HTTP_PROXY=$1 + HTTPS_PROXY=$2 + NO_PROXY=$3 + CHE_VERSION=$4 + IP=$5 + PORT=$6 + PROVISION_PROGRESS=$7 + + if [ "${IP,,}" = "dhcp" ]; then + echo "----------------------------------------" + echo "ECLIPSE CHE: CHECKING DYNAMIC IP ADDRESS" + echo "----------------------------------------" + DEV=$(grep -l "VAGRANT-BEGIN" /etc/sysconfig/network-scripts/ifcfg-*|xargs grep "DEVICE="|sort|tail -1|cut -d "=" -f 2) + if [ -z "${DEV}" ]; then + >&2 echo "Unable to find DHCP network device" + exit 1 + fi + IP=$(ip addr show dev ${DEV} | sed -r -e '/inet [0-9]/!d;s/^[[:space:]]*inet ([^[:space:]/]+).*$/\1/') + if [ -z "${IP}" ]; then + >&2 echo "Unable to find DHCP network ip" + exit 1 + fi + echo "IP: ${IP}" + echo + fi + + if [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then + echo "-------------------------------------" + echo "." + echo "ECLIPSE CHE: CONFIGURING SYSTEM PROXY" + echo "." + echo "-------------------------------------" + echo 'export HTTP_PROXY="'$HTTP_PROXY'"' >> /home/vagrant/.bashrc + echo 'export HTTPS_PROXY="'$HTTPS_PROXY'"' >> /home/vagrant/.bashrc + source /home/vagrant/.bashrc + + # Configuring the Che properties file - mounted into Che container when it starts + echo 'http.proxy="'$HTTP_PROXY'"' >> /home/user/che/conf/che.properties + echo 'https.proxy="'$HTTPS_PROXY'"' >> /home/user/che/conf/che.properties + + echo "HTTP PROXY set to: $HTTP_PROXY" + echo "HTTPS PROXY set to: $HTTPS_PROXY" + fi + + function perform + { + local progress=$1 + local command=$2 + shift 2 + + local pid="" + + case "$progress" in + extended) + # simulate tty environment to get full output of progress bars and percentages + printf "set timeout -1\nspawn %s\nexpect eof" "$command $*" | expect -f - + ;; + basic|*) + $command "$@" &>/dev/null & + pid=$! + while kill -0 "$pid" >/dev/null 2>&1; do + printf "#" + sleep 10 + done + wait $pid # return pid's exit code + ;; + esac + } + + echo "------------------------------------" + echo "ECLIPSE CHE: UPGRADING DOCKER ENGINE" + echo "------------------------------------" + if [ "$PROVISION_PROGRESS" = "extended" ]; then + # we sacrifice a few seconds of additional install time for much better progress afterwards + perform basic yum -y install expect + fi + perform $PROVISION_PROGRESS sudo yum -y update docker-engine + + echo $(docker --version) + + # Add the 'vagrant' user to the 'docker' group + usermod -aG docker vagrant &>/dev/null + + # We need write access to this file to enable Che container to create other containers + sudo chmod 777 /var/run/docker.sock &>/dev/null + + # Setup the overlay storage driver to eliminate errors + sudo sed -i '/ExecStart=\/usr\/bin\/dockerd/c\ExecStart=\/usr\/bin\/dockerd --storage-driver=overlay' /lib/systemd/system/docker.service + + # Configure Docker daemon with the proxy + if [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then + mkdir /etc/systemd/system/docker.service.d + fi + if [ -n "$HTTP_PROXY" ]; then + printf "[Service]\nEnvironment=\"HTTP_PROXY=${HTTP_PROXY}\"" > /etc/systemd/system/docker.service.d/http-proxy.conf + printf "" + fi + if [ -n "$HTTPS_PROXY" ]; then + printf "[Service]\nEnvironment=\"HTTPS_PROXY=${HTTPS_PROXY}\"" > /etc/systemd/system/docker.service.d/https-proxy.conf + fi + if [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then + printf "[Service]\nEnvironment=\"NO_PROXY=${NO_PROXY}\"" > /etc/systemd/system/docker.service.d/no-proxy.conf + fi + + systemctl daemon-reload + systemctl restart docker + + echo "--------------------------------------------------" + echo "ECLIPSE CHE: DOWNLOADING ECLIPSE CHE DOCKER IMAGES" + echo "--------------------------------------------------" + perform $PROVISION_PROGRESS docker pull codenvy/che-launcer:${CHE_VERSION} + perform $PROVISION_PROGRESS docker pull codenvy/che-server:${CHE_VERSION} + + echo "--------------------------------" + echo "ECLIPSE CHE: BOOTING ECLIPSE CHE" + echo "--------------------------------" + curl -sL https://raw.githubusercontent.com/eclipse/che/master/che.sh | tr -d '\15\32' > /home/vagrant/che.sh + chmod +x /home/vagrant/che.sh + export CHE_CONF_FOLDER=/home/user/che/conf/ + export CHE_PORT=${PORT} + export CHE_VERSION=${CHE_VERSION} + export CHE_HOST_IP=172.17.0.1 + export CHE_HOSTNAME=${CHE_IP} + /home/vagrant/che.sh start + +# docker run --net=host --name=che --restart=always --detach ` +# `-v /var/run/docker.sock:/var/run/docker.sock ` +# `-v /home/user/che/lib:/home/user/che/lib-copy ` +# `-v /home/user/che/workspaces:/home/user/che/workspaces ` +# `-v /home/user/che/storage:/home/user/che/storage ` +# `-v /home/user/che/conf:/container ` +# `-e CHE_LOCAL_CONF_DIR=/container ` +# `codenvy/che:${CHE_VERSION} --remote:${IP} --port:${PORT} run &>/dev/null + SHELL + + config.vm.provision "shell" do |s| + s.inline = $script + s.args = [$http_proxy, $https_proxy, $no_proxy, $che_version, $ip, $containerPort, $provisionProgress] + end + + $script2 = <<-'SHELL' + IP=$1 + PORT=$2 + MAPPED_PORT=$3 + + if [ "${IP,,}" = "dhcp" ]; then + DEV=$(grep -l "VAGRANT-BEGIN" /etc/sysconfig/network-scripts/ifcfg-*|xargs grep "DEVICE="|sort|tail -1|cut -d "=" -f 2) + IP=$(ip addr show dev ${DEV} | sed -r -e '/inet [0-9]/!d;s/^[[:space:]]*inet ([^[:space:]/]+).*$/\1/') + fi + + rm -f /home/user/che/.che_url + rm -f /home/user/che/.che_host_port + CHE_URL="http://${IP}:${PORT}" + + echo "${CHE_URL}" > /home/user/che/.che_url + echo "${MAPPED_PORT}" > /home/user/che/.che_host_port + + SHELL + + config.vm.provision "shell", run: "always" do |s| + s.inline = $script2 + s.args = [$ip, $containerPort, $hostPort] + end + +end diff --git a/che.sh b/che.sh index 5a093767f1..b79b83494f 100755 --- a/che.sh +++ b/che.sh @@ -31,7 +31,7 @@ init_global_variables() { CHE_TEST_CONTAINER_NAME="che-test" # User configurable variables - DEFAULT_CHE_VERSION="latest" + DEFAULT_CHE_VERSION="nightly" DEFAULT_CHE_CLI_ACTION="help" CHE_VERSION=${CHE_VERSION:-${DEFAULT_CHE_VERSION}} @@ -103,7 +103,6 @@ get_mount_path() { echo $(get_clean_path $POSIX_PATH) } - docker_exec() { if is_boot2docker || is_docker_for_windows; then MSYS_NO_PATHCONV=1 docker.exe "$@" @@ -124,7 +123,7 @@ parse_command_line () { CHE_CLI_ACTION="help" else case $1 in - start|stop|restart|update|info|init|up|mount|test|help|-h|--help) + start|stop|restart|update|info|init|up|mount|test|debug|help|-h|--help) CHE_CLI_ACTION=$1 ;; *) @@ -175,10 +174,19 @@ has_docker_for_windows_ip() { fi } +has_docker_for_windows_client(){ + ARCH=$(docker version --format {{.Client}} | cut -d" " -f5) + if [ "${ARCH}" = "windows" ]; then + return 0 + else + return 1 + fi +} + is_moby_vm() { NAME_MAP=$(docker info | grep "Name:" | cut -d" " -f2) - if [ "${NAME_MAP}" = "*moby*" ]; then + if [ "${NAME_MAP}" == "moby" ]; then return 0 else return 1 @@ -186,7 +194,7 @@ is_moby_vm() { } is_docker_for_mac() { - if is_moby_vm && ! has_docker_for_windows_ip; then + if is_moby_vm && ! has_docker_for_windows_client; then return 0 else return 1 @@ -194,7 +202,15 @@ is_docker_for_mac() { } is_docker_for_windows() { - if is_moby_vm && has_docker_for_windows_ip; then + if is_moby_vm && has_docker_for_windows_client; then + return 0 + else + return 1 + fi +} + +is_native() { + if [ $(get_docker_install_type) = "native" ]; then return 0 else return 1 @@ -217,7 +233,6 @@ get_list_of_variables() { RETURN="" CHE_VARIABLES=$(env | grep "CHE_") for SINGLE_VARIABLE in $CHE_VARIABLES; do - # Note the funky syntax - have to use the \b otherwise -e is interpreted as option to echo VALUE=" --env ${SINGLE_VARIABLE}" RETURN="${RETURN}""${VALUE}" done @@ -233,7 +248,6 @@ check_current_image_and_update_if_not_found() { else update_che_image $1 fi - } execute_che_launcher() { @@ -297,7 +311,6 @@ mount_local_directory() { "${CHE_MOUNT_IMAGE_NAME}":"${CHE_VERSION}" $(get_docker_host_ip) $3 } - execute_che_test() { docker_exec run --rm -it --name "${CHE_TEST_CONTAINER_NAME}" \ @@ -305,6 +318,27 @@ execute_che_test() { "${CHE_TEST_IMAGE_NAME}":"${CHE_VERSION}" "$@" } +print_che_cli_debug() { + debug "---------------------------------------" + debug "--------- CHE CLI DEBUG INFO --------" + debug "---------------------------------------" + debug "" + debug "--------- PLATFORM INFO -------------" + debug "DOCKER_INSTALL_TYPE = $(get_docker_install_type)" + debug "DOCKER_HOST_IP = $(get_docker_host_ip)" + debug "IS_DOCKER_FOR_WINDOWS = $(is_docker_for_windows && echo "YES" || echo "NO")" + debug "IS_DOCKER_FOR_MAC = $(is_docker_for_mac && echo "YES" || echo "NO")" + debug "IS_BOOT2DOCKER = $(is_boot2docker && echo "YES" || echo "NO")" + debug "IS_NATIVE = $(is_native && echo "YES" || echo "NO")" + debug "HAS_DOCKER_FOR_WINDOWS_IP = $(has_docker_for_windows_ip && echo "YES" || echo "NO")" + debug "IS_MOBY_VM = $(is_moby_vm && echo "YES" || echo "NO")" + debug "" + debug "" + debug "---------------------------------------" + debug "---------------------------------------" + debug "---------------------------------------" +} + # See: https://sipb.mit.edu/doc/safe-shell/ set -e set -u @@ -333,6 +367,9 @@ case ${CHE_CLI_ACTION} in test) execute_che_test "$@" ;; + debug) + print_che_cli_debug + ;; help) usage ;; diff --git a/dockerfiles/che-launcher/launcher_funcs.sh b/dockerfiles/che-launcher/launcher_funcs.sh index 4ceaa8d74f..cd86b42c3f 100644 --- a/dockerfiles/che-launcher/launcher_funcs.sh +++ b/dockerfiles/che-launcher/launcher_funcs.sh @@ -73,8 +73,8 @@ is_boot2docker() { } has_docker_for_windows_ip() { - DOCKER_HOST_IP=$(get_docker_host_ip) - if [ "${DOCKER_HOST_IP}" = "10.0.75.2" ]; then + ETH0_ADDRESS=$(docker run --net host alpine /bin/sh -c "ifconfig eth0" | grep "inet addr:" | cut -d: -f2 | cut -d" " -f1) + if [ "${ETH0_ADDRESS}" = "10.0.75.2" ]; then return 0 else return 1 @@ -205,7 +205,8 @@ get_che_container_conf_folder() { } get_che_container_data_folder() { - get_che_container_host_bind_folder "/home/user/che/workspaces" + FOLDER=$(get_che_container_host_bind_folder "/home/user/che/workspaces") + echo "${FOLDER:=not set}" } get_che_container_image_name() {