summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Schwarz <seschwar@users.noreply.github.com>2016-02-10 13:31:46 +0100
committerChristian Bundy <christianbundy@fraction.io>2016-09-27 00:11:31 +0000
commitcbd2ba52af076219198a002533ac75fcd75a1ca3 (patch)
treeeb5611813989d035b78d388b682db8c9134c74c3
parent803ff5030e1977e49bca7feea02d74afeabd6356 (diff)
downloaddocker-py-cbd2ba52af076219198a002533ac75fcd75a1ca3.tar.gz
Synthesize executable bit on Windows
The build context is tarred up on the client and then sent to the Docker daemon. However Windows permissions don't match the Unix ones. Therefore we have to mark all files as executable when creating a build context on Windows, like `docker build` already does: https://github.com/docker/docker/issues/11047. Signed-off-by: Sebastian Schwarz <seschwar@gmail.com>
-rw-r--r--docker/utils/utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py
index d46f8fc..62e06a2 100644
--- a/docker/utils/utils.py
+++ b/docker/utils/utils.py
@@ -4,6 +4,7 @@ import os
import os.path
import json
import shlex
+import sys
import tarfile
import tempfile
import warnings
@@ -92,7 +93,10 @@ def tar(path, exclude=None, dockerfile=None, fileobj=None, gzip=False):
exclude = exclude or []
for path in sorted(exclude_paths(root, exclude, dockerfile=dockerfile)):
- t.add(os.path.join(root, path), arcname=path, recursive=False)
+ i = t.gettarinfo(os.path.join(root, path), arcname=path)
+ if sys.platform == 'win32':
+ i.mode = i.mode & 0o755 | 0o111
+ t.addfile(i)
t.close()
fileobj.seek(0)