Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Busybox wget to download jar fails with an error "wget: server returned error: HTTP/1.1 307 Temporary Redirect"

I am using adoptopenjdk/openjdk11:alpine-jre base image for java and trying below instruction inside my Dockerfile,

RUN wget -O dd-java-agent.jar "https://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.datadoghq&a=dd-java-agent&v=LATEST"

which produces an error: Connecting to repository.sonatype.org (18.208.14.211:443) wget: server returned error: HTTP/1.1 307 Temporary Redirect

Is there a way to download the latest version of jar file from nexus using wget utility available with Busybox?

Alpine version: v3.12.0 | Busybox version: v1.31.1

Note: If I specify the exact version of jar like RUN wget -O dd-java-agent.jar 'https://repository.sonatype.org/service/local/repositories/central-proxy/content/com/datadoghq/dd-java-agent/0.38.0/dd-java-agent-0.38.0.jar' it succeeded. I am aware of other option is to use curl in this case. Just trying to keep it simple and avoiding the installation of curl, its usage, and then removal.

like image 954
sham Avatar asked Oct 19 '25 15:10

sham


1 Answers

BusyBox replaces Wget with a compact implementation of its own, which does not support all the security features and options such as https redirects. Worse, the BusyBox TLS library does not support certificate validation nor the option --no-check-certificate. Issue discussed on Git https://github.com/sabotage-linux/sabotage/issues/252 6 years ago but actually never fixed.

There is no solution with busybox wget other then:

  • adding the real wget to your build
  • adding curl
like image 86
scavenger Avatar answered Oct 21 '25 15:10

scavenger