Is docker file different on WSL and Windows?

I have the following Dockerfile

FROM jupyter/pyspark-notebook:python-3.9.12


USER root

RUN wget -q "${HADOOP_VERSION}/hadoop-aws-${HADOOP_VERSION}.jar" -P /usr/local/jars/ && \
    wget -q "${AWS_SDK_VERSION}/aws-java-sdk-bundle-${AWS_SDK_VERSION}.jar" -P /usr/local/jars/ && \
    wget -q "" -P /usr/local/jars/

RUN echo 'spark.driver.extraClassPath /usr/local/jars/*' >> "${SPARK_HOME}/conf/spark-defaults.conf" && \
    echo 'spark.serializer org.apache.spark.serializer.KryoSerializer' >> "${SPARK_HOME}/conf/spark-defaults.conf" && \
    echo ' True' >> "${SPARK_HOME}/conf/spark-defaults.conf" && \
    echo 'spark.hadoop.fs.s3a.impl org.apache.hadoop.fs.s3a.S3AFileSystem' >> "${SPARK_HOME}/conf/spark-defaults.conf"

COPY requirements.txt requirements.txt

RUN pip install -r requirements.txt && \
    pip install "jupyterlab>=3" "ipywidgets>=7.6"

When I run docker build . I got the following error

 ---> Running in c4476a455d86
The command '/bin/bash -o pipefail -c wget -q "${HADOOP_VERSION}/hadoop-aws-${HADOOP_VERSION}.jar" -P /usr/local/jars/ &&     wget -q "${AWS_SDK_VERSION}/aws-java-sdk-bundle-${AWS_SDK_VERSION}.jar" -P /usr/local/jars/ &&     wget -q "" -P /usr/local/jars/' returned a non-zero code: 8

I’m running docker on WSL. My question is: Why am I getting this error since I can build this Dockerfile on windows but not on WSL?

Docker Desktop for Windows runs containers in a WSL distribution so we should clarify what you mean by “on WSL”. Do you mean you installed “docker-ce” inside your WSL distribution not created by Docker Desktop?

I guess you do, because the only difference I can think of is the network in the WSL distribution of Docker Desktop and your own.