question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error preparing context folder under Windows

See original GitHub issue

This issue relates to the following bmuschko/gradle-docker-plugin#432

The Docker Gradle plugin is using the docker-java library in version 3.0.12. When using the plugin in a Gradle build under Windows the following exception occurs (only snippet):

        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
        ... 70 more
Caused by: java.io.IOException: Der Prozess kann nicht auf die Datei zugreifen, da ein anderer Prozess einen Teil der Datei gesperrt hat
        at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2146)
        at org.apache.commons.io.IOUtils.copy(IOUtils.java:2102)
        at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2123)
        at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1107)
        at com.github.dockerjava.core.util.CompressArchiveUtil.archiveTARFiles(CompressArchiveUtil.java:105)
        at com.github.dockerjava.core.dockerfile.Dockerfile$ScannedResult.buildDockerFolderTar(Dockerfile.java:135)
        ... 92 more
        Suppressed: java.io.IOException: This archives contains unclosed entries.
                at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.finish(TarArchiveOutputStream.java:225)
                at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.close(TarArchiveOutputStream.java:241)
                at com.github.dockerjava.core.util.CompressArchiveUtil.archiveTARFiles(CompressArchiveUtil.java:109)
                at com.github.dockerjava.core.dockerfile.Dockerfile$ScannedResult.buildDockerFolderTar(Dockerfile.java:135)

The IOException tells me that someone has locked a file the library wants to use and include in the context TAR file. But this bug only happens under Windows, when I run the exact same build on my Mac everything is OK.

Any ideas how to analyse / fix this? If you need a project to reproduce the behaviour, you can use https://github.com/lreimer/everything-as-code

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
orzehcommented, Aug 7, 2017

@lreimer I don’t think this is a bug. To build image you have to send build context to docker daemon. In your case one of files is locked (partially) and can’t be read. How would you fix that? The only solution is to release the lock.

1reaction
lreimercommented, Aug 7, 2017

Thanks for all your comments.

I already have a .dockerignore file. The file I want to add via COPY is a .tar file produced by the application plugin in the Gradle build/ directory.

So I will try to narrow down the build/ directory even further using .dockerignore. Maybe that helps. Otherwise I will try to copy the file somewhere else and use it from there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Open File Location fails from any shortcut context menu giving ...
The problem: I right-click any shortcut icon on the desktop, choose "open file location" from the context menu, and receive an error dialog ......
Read more >
How can I solve "unable to prepare context: path "." not found ...
I have Docker-CE 18.06 installed on CentOS 7 guest OS, running on VMWare Player 14. The project directory is inside shared folder mounted...
Read more >
6 Ways to Fix Windows 11 Stuck on Preparing Windows Loop
Do you get stuck in the Preparing Windows screen when updating your OS? Here's how you can fix it. ... Choose Restart from...
Read more >
Troubleshooting GitLab Runner
If GitLab Runner is running as a service on Windows, it creates system event ... Error: zoneinfo.zip: no such file or directory error...
Read more >
Troubleshooting - Unity - Manual
Error messages in the Package Manager window ... try to use the My Assets context, the Package Manager displays an error in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found