Using wget
or curl
commands to retrieve remote content in Dockerfiles instead of the ADD
instruction can
lead to several issues, particularly related to the inefficient use of Docker’s build cache.
Docker’s build cache is a powerful feature that can significantly speed up the build process by reusing intermediate layers from previous builds if
no changes were detected. When you use wget
, curl
, or similar commands, these commands are run during the build process, and
Docker has no way of knowing if the remote content has changed without executing the commands. This makes it impossible to effectively cache the
results of these commands.
Moreover, the installation of third-party tools inside the image can introduce unnecessary complexity, dependency on external tools and increase
the size of the final image.