Skip to content

Commit e229005

Browse files
committed
Fixes execute permissions for files not contained in any dir that are added to tar using copyArchiveToContainerCmdIml.
1 parent f4dc563 commit e229005

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ public static void tar(Path inputPath, Path outputPath, boolean gZipped, boolean
6767

6868
try (TarArchiveOutputStream tarArchiveOutputStream = buildTarStream(outputPath, gZipped)) {
6969
if (!Files.isDirectory(inputPath)) {
70-
putTarEntry(tarArchiveOutputStream, new TarArchiveEntry(inputPath.getFileName().toString()), inputPath);
70+
TarArchiveEntry tarEntry = new TarArchiveEntry(inputPath.getFileName().toString());
71+
if (filePath.toFile().canExecute()) {
72+
tarEntry.setMode(tarEntry.getMode() | 0755);
73+
}
74+
putTarEntry(tarArchiveOutputStream, tarEntry, inputPath);
7175
} else {
7276
Path sourcePath = inputPath;
7377
if (!childrenOnly) {

0 commit comments

Comments
 (0)