Description
wget and curl overlap in download functionality, but their features and options are not identical. If both are installed for the same purpose, consider using one. Keeping both is reasonable when distinct features are needed.
Potential impact
Unnecessary duplicate tools can increase image size and the number of dependencies to maintain.
Remediation
Choose a tool that meets the requirements and use consistent download error handling. Retain tools needed for other tasks.
Examples
The examples install the tools before consolidating the same downloads on curl. The example.com URLs are illustrative; replace them with verified artifact locations.
Before
dockerfile
FROM debian:12
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl wget \
&& rm -rf /var/lib/apt/lists/*
RUN wget https://example.com/file1.tar.gz
RUN curl -fsSL https://example.com/file2.tar.gz -o file2.tar.gz
After
dockerfile
FROM debian:12
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://example.com/file1.tar.gz -o file1.tar.gz \
&& curl -fsSL https://example.com/file2.tar.gz -o file2.tar.gz