1

I am using the wget inside the Dockerfile

    FROM wso2/wso2mi:4.0.0
COPY /lib/* $WSO2_SERVER_HOME/lib/
COPY /carFiles/common-20.11.0-SNAPSHOT.car $WSO2_SERVER_HOME/repository/deployment/server/carbonapps/
COPY jdk8.tar.gz $WORKING_DIRECTORY/
#Download and configure Java 8
RUN \
   # wget -O jdk8.tar.gz github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz; \
    mkdir -p ${WORKING_DIRECTORY}/openjdk-8; \
    cd ${WORKING_DIRECTORY}/openjdk-8; \
    tar -xf ${WORKING_DIRECTORY}/jdk8.tar.gz --strip-components=1; \
    export PATH=${WORKING_DIiRECTORY}/openjdk-8/bin:$PATH; \
    rm ${WORKING_DIRECTORY}/jdk8.tar.gz;

ENV JAVA_HOME=${WORKING_DIRECTORY}/openjdk-8 \
    PATH=${WORKING_DIRECTORY}/openjdk-8/bin:$PATH

But its failing with the error

wget: bad address 'github.com' tar: can't open '/home/wso2carbon/jdk8.tar.gz': No such file or directory rm: can't remove '/home/wso2carbon/jdk8.tar.gz': No such file or directory

i am trying to build the image with this Docker command

docker build -f  Dockerfile -t myimage:21.0.82   .

then as per the another SO post

docker build -f  Dockerfile -t myimage:21.0.82  --network host .

this also failed with same issue .

If directly i am using

wget -O jdk8.tar.gz https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz;

its working fine without any issue . Is this a Dockerfile issue or wget?

Even this SO post not helped .

Subodh Joshi
  • 12,717
  • 29
  • 108
  • 202
  • Add the entire `Dockerfile` try also to create a new `Dockerfile` with only `FROM ...` and `wget` command. I suspect is a network/proxy related problem. – Max Jun 29 '21 at 17:31
  • @Max Added the full DockerFile Contents ,wget not working when trying from inside DockerFile but when trying outside directly its working in same VM, – Subodh Joshi Jun 30 '21 at 07:46
  • I have started the image `docker run -dt wso2/wso2mi:4.0.0` then I attached to it a shell `docker exec -it containerName sh` and then I submit the command `wget -O jdk8.tar.gz https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz`. Result: Downloaded without a problem. The issue is in your network. – Max Jun 30 '21 at 18:02
  • `wget` u run from outside of DockerFile or its executing when you executing the Docker build command? – Subodh Joshi Jul 01 '21 at 08:32
  • I don't run the Docker build command I start a container and then I run the commands INSIDE the container, try the same steps and tell me how it went. – Max Jul 01 '21 at 10:17
  • Sorry to say but my requirement is run the wget before making a image file of my application. – Subodh Joshi Jul 01 '21 at 10:32
  • When you run the build command docker span a container (of type FROM clause) and execute commands of Dockerfile. My commands _debug_ your Dockerfile, I suspect that if you try to run the commands above you receive the same error. Otherwise run a container and from the shell try to execute the command in your Dockerfile. – Max Jul 01 '21 at 11:57
  • Look like this issue with all wget from inside DockerFile `wget: bad address 'download.java.net' The command '/bin/sh -c wget -O jdk8.tar.gz https://download.java.net/openjdk/jdk10/ri/openjdk-10+44_linux-x64_bin_ri.tar.gz;' returned a non-zero code: 1 ` – Subodh Joshi Jul 01 '21 at 15:38

0 Answers0