skip to Main Content

I’m not really good at network,
I can’t see what changed with the command wget inside when I ran docker build --build-arg https_proxy="http://proxy-fg:8080/" and wget outside from the vm? Any ideas?

[root@LQL-BDDBAS01 pg13]# export https_proxy=http://proxy-fg:8080/
[root@LQL-BDDBAS01 pg13]# wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v13.13/postgresql-13.13.tar.bz2"
--2024-03-25 17:42:23--  https://ftp.postgresql.org/pub/source/v13.13/postgresql-13.13.tar.bz2
Résolution de proxy-fg (proxy-fg)… 10.1.100.254
Connexion à proxy-fg (proxy-fg)|10.1.100.254|:8080… connecté.
requête Proxy transmise, en attente de la réponse… 200 OK
Taille : 21563452 (21M) [application/octet-stream]
Sauvegarde en : « postgresql.tar.bz2 »

postgresql.tar.bz2                                  100%[=================================================================================================================>]  20,56M  5,79MB/s    ds 3,6s

2024-03-25 17:42:28 (5,79 MB/s) — « postgresql.tar.bz2 » sauvegardé [21563452/21563452]
[root@LQL-BDDBAS01 pg13]# docker build --build-arg https_proxy="http://proxy-fg:8080/" --tag postgres13:alpine3.18 .
[+] Building 132.4s (8/12)                                                                                                                                                                     docker:default
 => [internal] load .dockerignore                                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                          0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                     0.0s
 => => transferring dockerfile: 8.07kB                                                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/alpine:3.18                                                                                                                                           1.1s
 => [1/8] FROM docker.io/library/alpine:3.18@sha256:11e21d7b981a59554b3f822c49f6e9f57b6068bb74f49c4cd5cc4c663c7e5160                                                                                     0.0s
 => [internal] load build context                                                                                                                                                                        0.0s
 => => transferring context: 102B                                                                                                                                                                        0.0s
 => CACHED [2/8] RUN set -eux;  addgroup -g 70 -S postgres;  adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres;  mkdir -p /var/lib/postgresql;  chown -R postgres:postgres   0.0s
 => CACHED [3/8] RUN mkdir /docker-entrypoint-initdb.d                                                                                                                                                   0.0s
 => ERROR [4/8] RUN set -eux;   wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v13.13/postgresql-13.13.tar.bz2";  echo "8af69c2599047a2ad246567d68ec4131aef116954d8c3e469e9789080b  131.2s
------
 > [4/8] RUN set -eux;          wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v13.13/postgresql-13.13.tar.bz2";     echo "8af69c2599047a2ad246567d68ec4131aef116954d8c3e469e9789080b37a474 *postgresql.tar.bz2" | sha256sum -c -;         mkdir -p /usr/src/postgresql;   tar             --extract               --file postgresql.tar.bz2               --directory /usr/src/postgresql              --strip-components 1     ;       rm postgresql.tar.bz2;          apk add --no-cache --virtual .build-deps                llvm15-dev              clang15                 bison           coreutils            dpkg-dev dpkg            flex            g++             gcc             krb5-dev                libc-dev                libedit-dev             libxml2-dev             libxslt-dev             linux-headers make            openldap-dev            openssl-dev             perl-dev                perl-ipc-run            perl-utils              python3-dev             tcl-dev                 util-linux-dev       zlib-dev                 icu-dev         ;               cd /usr/src/postgresql;         awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == ""/tmp"" { $3 = ""/var/run/postgresql""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new;      grep '/var/run/postgresql' src/include/pg_config_manual.h.new;  mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h;         gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)";      wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb';    wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb';          export LLVM_CONFIG="/usr/lib/llvm15/bin/llvm-config";         export CLANG=clang-15;          ./configure             --enable-option-checking=fatal          --build="$gnuArch"              --enable-integer-datetimes              --enable-thread-safety                --enable-tap-tests              --disable-rpath                 --with-uuid=e2fs                --with-gnu-ld           --with-pgport=5432              --with-system-tzdata=/usr/share/zoneinfo              --prefix=/usr/local             --with-includes=/usr/local/include              --with-libraries=/usr/local/lib                 --with-gssapi           --with-ldap             --with-tcl            --with-perl             --with-python           --with-openssl          --with-libxml           --with-libxslt          --with-icu              --with-llvm     ;       make -j "$(nproc)" world;     make install-world;     make -C contrib install;                runDeps="$(             scanelf --needed --nobanner --format '%n#p' --recursive /usr/local                      | tr ',' 'n'        | sort -u                        | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }'                         | grep -v -e perl -e python -e tcl      )";     apk add --no-cache --virtual .postgresql-rundeps              $runDeps                bash            su-exec                 tzdata          zstd            icu-data-full           $([ "$(apk --print-arch)" != 'ppc64le' ] && echo 'nss_wrapper')       ;       apk del --no-network .build-deps;       cd /;   rm -rf          /usr/src/postgresql             /usr/local/share/doc            /usr/local/share/man    ;       echo '{"spdxVersion":"SPDX-2.3","SPDXID":"SPDXRef-DOCUMENT","name":"postgres-sbom","packages":[{"name":"postgres","versionInfo":"13.13","SPDXID":"SPDXRef-Package--postgres","externalRefs":[{"referenceCategory":"PACKAGE-MANAGER","referenceType":"purl","referenceLocator":"pkg:generic/[email protected]?os_name=alpine&os_version=3.18"}],"licenseDeclared":"PostgreSQL"}]}' > /usr/local/postgres.spdx.json      ;       postgres --version:
0.312 + wget -O postgresql.tar.bz2 https://ftp.postgresql.org/pub/source/v13.13/postgresql-13.13.tar.bz2
0.371 Connecting to ftp.postgresql.org (147.75.85.69:443)
131.1 wget: can't connect to remote host (147.75.85.69): Operation timed out
------
Dockerfile:34

2

Answers


  1. Chosen as BEST ANSWER

    After several tests, I'm pretty sure that inside docker build, the env config for https_proxy isn't taken account by the command RUN. It explains why wget ran into timeout I found this article : Docker ignores HTTP Proxy settings completly, but the issus was reported at 2022! : https://github.com/docker/for-linux/issues/1444

    [root@LQL-BDDBAS01 pg13]# docker build --no-cache --progress=plain  --tag postgres13:alpine3.18 .
    #0 building with "default" instance using docker driver
    
    #1 [internal] load .dockerignore
    #1 transferring context: 2B done
    #1 DONE 0.0s
    
    #2 [internal] load build definition from Dockerfile
    #2 transferring dockerfile: 8.12kB done
    #2 DONE 0.0s
    
    #3 [internal] load metadata for docker.io/library/alpine:3.18
    #3 DONE 0.4s
    
    #4 [ 1/10] FROM docker.io/library/alpine:3.18@sha256:11e21d7b981a59554b3f822c49f6e9f57b6068bb74f49c4cd5cc4c663c7e5160
    #4 CACHED
    
    #5 [internal] load build context
    #5 transferring context: 102B done
    #5 DONE 0.0s
    
    #6 [ 2/10] RUN env
    #6 0.345 HTTPS_PROXY=http://proxy-fg:8080
    #6 0.345 SHLVL=1
    #6 0.345 HOME=/root
    #6 0.345 https_proxy=http://proxy-fg:8080
    #6 0.345 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    #6 0.345 PWD=/
    #6 DONE 0.4s
    
    #7 [ 3/10] RUN wget -O test "https://google.com"
    #7 0.384 Connecting to google.com (216.58.212.110:443)
    

  2. I found it! There is nothing wrong with docker side (neither server nor client). It’s due to the wget in the busybox release, we could reinstall the wget with apk add wget, and wget considers the https_proxy.
    Problem resolved!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search