Skip to content

Commit 48ef8e3

Browse files
committed
Use canonical form of Docker folder when building TAR files
In BuildImageCmdImpl#buildDockerFolderTar a canonical form of the source files referenced in the Dockerfile is used. But the Docker folder is passed in the given form to the CompressArchiveUtil. CompressArchiveUtil#relativize creates absolute TAR archive entries if the canonical form of the source files differs from the given form of the Docker folder. As a result, the Docker deamon can not find the files during the build. This can happen in case-insensitive file systems such as Windows, for example. As a solution, the canonical form of the Docker folder must be used.
1 parent b8f95be commit 48ef8e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/github/dockerjava/core/CompressArchiveUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static File archiveTARFiles(File base, Iterable<File> files, String archi
1515
tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
1616
for (File file : files) {
1717
TarArchiveEntry tarEntry = new TarArchiveEntry(file);
18-
tarEntry.setName(relativize(base, file));
18+
tarEntry.setName(relativize(base.getCanonicalFile(), file.getCanonicalFile()));
1919

2020
if (!file.isDirectory()) {
2121
if (file.canExecute()) {

0 commit comments

Comments
 (0)