You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 3, 2025. It is now read-only.
Some RUN instructions on Dockerfiles can leave processes running in the background (e.g. daemons). If these daemons are writting to files in the context dir, tar will fail with:
archive/tar: write too long
... when the layer is being snapshotted, because files were modified after the tar header was written.
One idea to prevent this is to execute RUN instructions in a nested PID namespace, and kill -9 its PID 1 before proceeding to the next instruction. Or perhaps a poor man's version of it with process groups to minimize the problem on environments that can't unshare a nested PID namespace.
It is easy to reproduce this when building Dockerfiles that use gradlew, which spawns a daemon by default, and is constantly writting to a log file inside the layer.
Some
RUNinstructions on Dockerfiles can leave processes running in the background (e.g. daemons). If these daemons are writting to files in the context dir,tarwill fail with:... when the layer is being snapshotted, because files were modified after the tar header was written.
One idea to prevent this is to execute
RUNinstructions in a nested PID namespace, andkill -9its PID 1 before proceeding to the next instruction. Or perhaps a poor man's version of it with process groups to minimize the problem on environments that can'tunsharea nested PID namespace.It is easy to reproduce this when building Dockerfiles that use
gradlew, which spawns a daemon by default, and is constantly writting to a log file inside the layer.