Use HEAD request to check state of cached remote resource for ADD command
Please, check https://docs.docker.com/docker-for-win/troubleshoot/. Issues without logs and details cannot be debugged, and will be closed.
- [ ] I have tried with the latest version of my channel (Stable or Edge)
- [ ] I have submitted Diagnostics
- [ ] I have included the Diagnostics ID in this Issue
- Windows Version: 10
- Docker for Windows Version: 18.03.0-ce
Expected behavior
ADD url local-path shouldn't download the whole file when checking cache.
Actual behavior
The ADD command always downloads the whole remote file regardless of the state of the docker cache and then compares it to the cached version of the file and re-runs the step if it's different.
Information
I understand from looking at the code that it's computing a hash of the remote file and it needs to download the file to do that normally. However, many servers provide sufficient information in a HEAD request to check if a file has been updated. Storing an ETag or file timestamp provided by the server should be sufficient to check if the cache is out of date.
I suspect most people end up installing and using curl or wget inside their images to avoid downloading remote files on every docker build.
Steps to reproduce the behavior
- Create a Dockerfile
- Base it off of some linux image, such as
ADD https://dist.nuget.org/win-x86-commandline/latest/nuget.exe /usr/local/bin/nuget.exe- Build the Dockerfile several times and watch it take some time on the ADD step each time to download the whole file.
This is not an issue with the Docker for Windows application itself but rather a potential enhancement in the upstream moby project. Could you file an issue on https://github.com/moby/moby instead. Closing here.
Sorry about that. From reading the Readme about posting issues it seemed like d4w might be the right place for this issue because it might have custom code around requests. I'll post it upstream
@sw-carlin no worries. it's sometimes hard to figure out where to post issues or feature request. Happens the other way round too.
Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.
If you have found a problem that seems similar to this, please open a new issue.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked