From 48ef8e364d725044862328fd6db0e3280c64ef51 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Thu, 2 Oct 2014 07:52:50 +0200 Subject: [PATCH] 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. --- .../java/com/github/dockerjava/core/CompressArchiveUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/dockerjava/core/CompressArchiveUtil.java b/src/main/java/com/github/dockerjava/core/CompressArchiveUtil.java index 2cf341bdc..a9a972382 100644 --- a/src/main/java/com/github/dockerjava/core/CompressArchiveUtil.java +++ b/src/main/java/com/github/dockerjava/core/CompressArchiveUtil.java @@ -15,7 +15,7 @@ public static File archiveTARFiles(File base, Iterable files, String archi tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); for (File file : files) { TarArchiveEntry tarEntry = new TarArchiveEntry(file); - tarEntry.setName(relativize(base, file)); + tarEntry.setName(relativize(base.getCanonicalFile(), file.getCanonicalFile())); if (!file.isDirectory()) { if (file.canExecute()) {