Wget fails in Dockerfile and works in CLI

Thank you in advance for any help.

I’m new to Docker and this may be a newbie question, but I’ve spent eight hours reading posts and Dockerfiles to no avail.

Issue: my wget command run outside of a Dockerfile succeeds, and fails when in the Dockerfile.

Note: I did use the working command in the Dockerfile without text replacement.

Working command:

wget --user-agent=testuser --referer=https://wso2.com/integration/download-thank-you/ https://product-dist.wso2.com/products/enterprise-integrator/6.1.1/wso2ei-6.1.1.zip

Dockerfile:

FROM anapsix/alpine-java
ENV PRODUCT_VERSION=${Version:-6.1.1}
ENV PRODUCT_CODE=ei
ENV PRODUCT_FOLDER=enterprise-integrator
ENV WORKING_DIRECTORY=/opt/wso2esb_${VERSION}

RUN wget --user-agent=testuser --referer=https://wso2.com/integration/download-thank-you/ https://product-dist.wso2.com/products/${PRODUCT_FOLDER}/${PRODUCT_VERSION}/wso2${PRODUCT_CODE}-${PRODUCT_VERSION}.zip
RUN apt-get install -y zip && \
apt-get upgrade -f && \
apt-get clean && \
unzip /opt/wso2esb-${PRODUCT_VERSION}.zip -d ${WORKING_DIRECTORY} && \
rm /opt/wso2esb-${PRODUCT_VERSION}.zip

RUN apt-get autoremove zip

EXPOSE 9443 9763 8243 8280
WORKDIR ${WORKING_DIRECTORY}
ENTRYPOINT ["bin/integrator.sh"]

docker build . output

Sending build context to Docker daemon 246.3MB
Step 1/11 : FROM anapsix/alpine-java
—> fedcd26522ec
Step 2/11 : MAINTAINER andreas237
—> Using cache
—> 55515a19771d
Step 3/11 : ENV PRODUCT_VERSION=${Version:-6.1.1}
—> Using cache
—> aa8e66a7ae92
Step 4/11 : ENV PRODUCT_CODE=ei
—> Using cache
—> b62f0ea4aae9
Step 5/11 : ENV PRODUCT_FOLDER=enterprise-integrator
—> Using cache
—> 207a67f35b00
Step 6/11 : ENV WORKING_DIRECTORY=/opt/wso2esb_${VERSION}
—> Using cache
—> 4d1f648c3b20
Step 7/11 : RUN wget --user-agent=testuser --referer=https://wso2.com/integration/download-thank-you/ https://product-dist.wso2.com/products/${PRODUCT_FOLDER}/${PRODUCT_VERSION}/wso2${PRODUCT_CODE}-${PRODUCT_VERSION}.zip
—> Running in 7ef4a5db21a7
wget: unrecognized option: referer=https://wso2.com/integration/download-thank-you/
BusyBox v1.26.2 (2017-11-23 08:40:54 GMT) multi-call binary.

Usage: wget [-c|–continue] [–spider] [-q|–quiet] [-O|–output-document FILE]
[–header ‘header: value’] [-Y|–proxy on/off] [-P DIR]
[-U|–user-agent AGENT] [-T SEC] URL…

Retrieve files via HTTP or FTP

--spider	Spider mode - only check file existence
-c		Continue retrieval of aborted transfer
-q		Quiet
-P DIR		Save to DIR (default .)
-T SEC		Network read timeout is SEC seconds
-O FILE		Save to FILE ('-' for stdout)
-U STR		Use STR for User-Agent header
-Y on/off	Use proxy

It seems wget binaries on some docker images have issues with https - on my image, apt-get install -y wget solved the issue.