azure-pipelines-tasks: [BUG]: No data was written into the file (Docker@2)
Task name
Docker@2
Task version
2.214.0
Environment type (Please select at least one enviroment where you face this issue)
- Self-Hosted
- Microsoft Hosted
- VMSS Pool
- Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Debian 11
Issue Description
I am getting this warning:
##[warning]No data was written into the file /home/vsts/work/_temp/task_outputs/build_****.txt
This was originally brought up in https://github.com/microsoft/azure-pipelines-tasks/issues/12470 but the issue was closed without it being resolved. Many users (including myself) are still facing this issue.
Task log
. . .
#8 exporting to image
#8 sha256:***
#8 exporting layers done
#8 writing image sha256:*** done
#8 naming to *** done
#8 DONE 0.0s
##[warning]No data was written into the file /__w/_temp/task_outputs/build_***.txt
Finishing: Docker build
Aditional info
- task: Docker@2
inputs:
command: 'build'
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 63
- Comments: 18
Workaround # 4:
Similar the the ones above, but this sets it for the entire stage/job in the yaml.
In case anyone doesn’t realize it, BuildKit became the default builder starting in Docker 23. BuildKit acts differently than the old builder, sending no output to stdout. That’s what the original ticket was about. The fix for the original ticket was to detect when BuildKit was enabled by looking at the
DOCKER_BUILDKIT
environment variable and acting appropriately when it was set. But with Docker 23 BuildKit is enable by default even if you don’t haveDOCKER_BUILDKIT
defined. But in that case the task doesn’t know you are using BuildKit so it expects the old builder behavior. This is why the workaround mentioned above of definingDOCKER_BUILDKIT
works.We use a self-hosted agent and when I started using Docker 23 on it, I defined
DOCKER_BUILDKIT
at the agent level, so it’s always defined for all jobs. So I have not run into this error again.Same problem, solution Workaround # 4 is no longer working
I am still getting this, even on a hosted agent AND with
DOCKER_BUILDKIT
set to1
.Another echoing of the chorus, we just started getting this on Azure Pipelines hosted agents in the past 24-48 hours on Docker@2 tasks. However it’s not breaking luckily for us anyway, will attempt to look into some of the workarounds if we get time.
thanks for sharing this info, I didn’t realize it. Great that you highlighted what’s going on in the back.
can confirm having the same issue using a VMSS pool using the Ubuntu Minimal LTS 22.04 image
canonical:0001-com-ubuntu-minimal-jammy:minimal-22_04-lts-gen2:latest
using this
docker version
So far this is the best workaround I have found. This sets the environment variable globally which gets rid of the warning.Workaround # 3:
Edit the
runsvc.sh
file in the agent directory and add the following export, then restart the agent service.EDIT:
This method does not seem to work consistently.
Just found another workaround. If you are using the newer version of Docker, just make sure you define the BuildKit env var in the task. The value doesn't seem to matter so you can use 0 or 1 to get rid of the error. It will be a pain to set this env in every task across every project. If anybody has a solution to do this at a global level please let me know. I have tried setting the buildkit feature in the daemon.json on the host and restarted the service but the pipeline still throws the warning.Workaround # 2:
EDIT:
This method does not seem to work consistently.
I have done some troubleshooting and may have stumbled upon something. I noticed that one of our agents do not get this error so I started doing some comparison with the other agents. It was running an older version of docker. I upgraded docker to match the version of the other agents and all the sudden it also started to get the error. I downgraded docker back to original and the error went away.
Here are my findings:
So far I have not found any issues with downgrading. BuildKit still works fine. Hopefully Microsoft will provide an update to this Docker@2 extension for the newer docker versions.
Here is what I did to “fix” the other agents.
Workaround # 1:
Having the same issue on same self-hosted Linux agent with the same task.