Unable to download a file with ADD because of the user agent #42317
Labels
area/builder/buildkit
Issues affecting buildkit
area/builder/classic-builder
Issues affecting the classic builder
area/builder
kind/enhancement
Enhancements are not bugs or new features but can improve usability or performance.
Description
The ADD instruction uses the user agent
go-http-client/1.1
when the source is an URL. If for some reason this user agent is blacklisted, downloading a file using ADD becomes impossible.Context
I was trying to bust a cached git repository, cloned from my company's own repositories, using ADD. Unfortunately, my company has a list of banned user agents, including
go-http-client/1.1
, that prevents me from downloading a file with this instruction.I am aware that several workarounds exist, hence this issue is not a priority, but for this use case, nothing is as simple as using ADD.
Describe the results you received:
The build fails with a message similar to
failed to load cache key: Get $URL: EOF
.Where
$URL
is the one fed to thesrc
argument of the ADD instruction.Describe the results you expected:
The file to be downloaded by the ADD instruction.
Possible solution:
I believe that if there was an optional flag
--user-agent
, to set the user agent used by ADD, it would fix the issue. Since the flag would be optional,go-http-client/1.1
would still be the default user agent.Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
Docker images are mainly built inside WSL2.
The text was updated successfully, but these errors were encountered: