Skip to content

Commit 4c263ee

Browse files
authored
Merge pull request #1943 from docker/3.1.1-release
3.1.1 release
2 parents 79f27c6 + 52c3d52 commit 4c263ee

9 files changed

+50
-8
lines changed

docker/api/build.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ def build(self, path=None, tag=None, quiet=False, fileobj=None,
143143
if os.path.exists(dockerignore):
144144
with open(dockerignore, 'r') as f:
145145
exclude = list(filter(
146-
bool, [l.strip() for l in f.read().splitlines()]
146+
lambda x: x != '' and x[0] != '#',
147+
[l.strip() for l in f.read().splitlines()]
147148
))
148149
context = utils.tar(
149150
path, exclude=exclude, dockerfile=dockerfile, gzip=gzip

docker/api/client.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ def __init__(self, base_url=None, version=None,
119119
)
120120
self.mount('http+docker://', self._custom_adapter)
121121
self._unmount('http://', 'https://')
122-
self.base_url = 'http+docker://localunixsocket'
122+
# host part of URL should be unused, but is resolved by requests
123+
# module in proxy_bypass_macosx_sysconf()
124+
self.base_url = 'http+docker://localhost'
123125
elif base_url.startswith('npipe://'):
124126
if not IS_WINDOWS_PLATFORM:
125127
raise DockerException(

docker/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version = "3.1.0"
1+
version = "3.1.1"
22
version_info = tuple([int(d) for d in version.split("-")[0].split(".")])

docs/change-log.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Change log
22
==========
33

4+
3.1.1
5+
-----
6+
7+
[List of PRs / issues for this release](https://github.com/docker/docker-py/milestone/46?closed=1)
8+
9+
### Bugfixes
10+
11+
* Fixed a bug that caused costly DNS lookups on Mac OSX when connecting to the
12+
engine through UNIX socket
13+
* Fixed a bug that caused `.dockerignore` comments to be read as exclusion
14+
patterns
15+
416
3.1.0
517
-----
618

tests/integration/api_build_test.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@ def test_build_with_dockerignore(self):
6161
'Dockerfile',
6262
'.dockerignore',
6363
'!ignored/subdir/excepted-file',
64-
'', # empty line
64+
'', # empty line,
65+
'#*', # comment line
6566
]))
6667

6768
with open(os.path.join(base_dir, 'not-ignored'), 'w') as f:
6869
f.write("this file should not be ignored")
6970

71+
with open(os.path.join(base_dir, '#file.txt'), 'w') as f:
72+
f.write('this file should not be ignored')
73+
7074
subdir = os.path.join(base_dir, 'ignored', 'subdir')
7175
os.makedirs(subdir)
7276
with open(os.path.join(subdir, 'file'), 'w') as f:
@@ -92,6 +96,7 @@ def test_build_with_dockerignore(self):
9296
logs = logs.decode('utf-8')
9397

9498
assert sorted(list(filter(None, logs.split('\n')))) == sorted([
99+
'/test/#file.txt',
95100
'/test/ignored/subdir/excepted-file',
96101
'/test/not-ignored'
97102
])

tests/integration/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def tearDown(self):
3636
pass
3737
for container in self.tmp_containers:
3838
try:
39-
client.api.remove_container(container, force=True)
39+
client.api.remove_container(container, force=True, v=True)
4040
except docker.errors.APIError:
4141
pass
4242
for network in self.tmp_networks:

tests/integration/models_containers_test.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,13 @@ def test_run_with_volume(self):
4747
self.tmp_containers.append(container.id)
4848
container.wait()
4949

50+
name = "container_volume_test"
5051
out = client.containers.run(
5152
"alpine", "cat /insidecontainer/test",
52-
volumes=["%s:/insidecontainer" % path]
53+
volumes=["%s:/insidecontainer" % path],
54+
name=name
5355
)
56+
self.tmp_containers.append(name)
5457
assert out == b'hello\n'
5558

5659
def test_run_with_named_volume(self):
@@ -66,10 +69,13 @@ def test_run_with_named_volume(self):
6669
self.tmp_containers.append(container.id)
6770
container.wait()
6871

72+
name = "container_volume_test"
6973
out = client.containers.run(
7074
"alpine", "cat /insidecontainer/test",
71-
volumes=["somevolume:/insidecontainer"]
75+
volumes=["somevolume:/insidecontainer"],
76+
name=name
7277
)
78+
self.tmp_containers.append(name)
7379
assert out == b'hello\n'
7480

7581
def test_run_with_network(self):

tests/unit/fake_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def post_fake_network_disconnect():
512512

513513

514514
# Maps real api url to fake response callback
515-
prefix = 'http+docker://localunixsocket'
515+
prefix = 'http+docker://localhost'
516516
if constants.IS_WINDOWS_PLATFORM:
517517
prefix = 'http+docker://localnpipe'
518518

tests/unit/utils_test.py

+16
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,22 @@ def test_last_line_precedence(self):
902902
['*.md', '!README*.md', 'README-secret.md']
903903
) == set(['README.md', 'README-bis.md'])
904904

905+
def test_parent_directory(self):
906+
base = make_tree(
907+
[],
908+
['a.py',
909+
'b.py',
910+
'c.py'])
911+
# Dockerignore reference stipulates that absolute paths are
912+
# equivalent to relative paths, hence /../foo should be
913+
# equivalent to ../foo. It also stipulates that paths are run
914+
# through Go's filepath.Clean, which explicitely "replace
915+
# "/.." by "/" at the beginning of a path".
916+
assert exclude_paths(
917+
base,
918+
['../a.py', '/../b.py']
919+
) == set(['c.py'])
920+
905921

906922
class TarTest(unittest.TestCase):
907923
def test_tar_with_excludes(self):

0 commit comments

Comments
 (0)