You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/11/23 09:11:26 UTC

[inlong] branch master updated: [INLONG-6604][DataProxy] Fix can not get the local IP in the docker container (#6605)

This is an automated email from the ASF dual-hosted git repository.

dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 58e3c2c96 [INLONG-6604][DataProxy] Fix can not get the local IP in the docker container (#6605)
58e3c2c96 is described below

commit 58e3c2c966a9ee0f78b13c8b4725e090d33049cc
Author: chestnufang <65...@users.noreply.github.com>
AuthorDate: Wed Nov 23 17:11:18 2022 +0800

    [INLONG-6604][DataProxy] Fix can not get the local IP in the docker container (#6605)
    
    Co-authored-by: chestnufang <ch...@tencent.com>
---
 inlong-dataproxy/dataproxy-docker/Dockerfile          | 2 ++
 inlong-dataproxy/dataproxy-docker/dataproxy-docker.sh | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/inlong-dataproxy/dataproxy-docker/Dockerfile b/inlong-dataproxy/dataproxy-docker/Dockerfile
index 069a479ed..87e35dbff 100644
--- a/inlong-dataproxy/dataproxy-docker/Dockerfile
+++ b/inlong-dataproxy/dataproxy-docker/Dockerfile
@@ -26,6 +26,8 @@ ADD ${DATAPROXY_TARBALL} /opt/inlong-dataproxy
 EXPOSE 46801 46802
 ENV MANAGER_OPENAPI_IP=127.0.0.1
 ENV MANAGER_OPENAPI_PORT=8083
+# specify the name of the network card in the container to obtain the local IP
+ENV ETH_NAME=eth1
 # enable audit, true or false
 ENV AUDIT_ENABLE=true
 ENV AUDIT_PROXY_URL=127.0.0.1:10081
diff --git a/inlong-dataproxy/dataproxy-docker/dataproxy-docker.sh b/inlong-dataproxy/dataproxy-docker/dataproxy-docker.sh
index 1280aeabe..8779c0a6d 100644
--- a/inlong-dataproxy/dataproxy-docker/dataproxy-docker.sh
+++ b/inlong-dataproxy/dataproxy-docker/dataproxy-docker.sh
@@ -17,7 +17,9 @@
 #
 
 file_path=$(cd "$(dirname "$0")"/../;pwd)
-local_ip=$(ifconfig | grep inet | grep -v inet6 | grep -v "127.0.0.1" | awk '{print $2}' | grep -v "30.*")
+# Obtain the local ip by specifying the network card name according to the environment variable and
+# it should be noted that this is a single network card IP acquisition method.
+local_ip=$(ifconfig $ETH_NAME | grep inet | grep -v inet6 | grep -v "127.0.0.1" | awk '{print $2}')
 # config
 cd "${file_path}/"
 common_conf_file=./conf/common.properties