Skip to content

Upgrade docker-py to its latest version (docker==3.1.1) #3243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 15, 2018
13 changes: 6 additions & 7 deletions readthedocs/doc_builder/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _, ugettext_noop
from docker import Client
from docker.utils import create_host_config
from docker import APIClient
from docker.errors import APIError as DockerAPIError, DockerException
from slumber.exceptions import HttpClientError

Expand Down Expand Up @@ -627,10 +626,9 @@ def get_client(self):
"""Create Docker client connection"""
try:
if self.client is None:
self.client = Client(
self.client = APIClient(
base_url=self.docker_socket,
version=DOCKER_VERSION,
timeout=None
)
return self.client
except DockerException as e:
Expand Down Expand Up @@ -702,7 +700,7 @@ def create_container(self):
exit=DOCKER_TIMEOUT_EXIT_CODE)),
name=self.container_id,
hostname=self.container_id,
host_config=create_host_config(binds={
host_config=client.create_host_config(binds={
SPHINX_TEMPLATE_DIR: {
'bind': SPHINX_TEMPLATE_DIR,
'mode': 'ro'
Expand All @@ -715,10 +713,11 @@ def create_container(self):
'bind': self.project.doc_path,
'mode': 'rw'
},
}),
},
mem_limit=self.container_mem_limit,
),
detach=True,
environment=self.environment,
mem_limit=self.container_mem_limit,
)
client.start(container=self.container_id)
except ConnectionError as e:
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/restapi/views/footer_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_version_compare_data(project, base_version=None):
}
if highest_version_obj:
ret_val['url'] = highest_version_obj.get_absolute_url()
ret_val['slug'] = highest_version_obj.slug,
ret_val['slug'] = (highest_version_obj.slug,)
if base_version and base_version.slug != LATEST:
try:
base_version_comparable = parse_version_failsafe(
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/rtd_tests/mocks/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self):
'readthedocs.doc_builder.backends.sphinx.EpubBuilder.move'),
'glob': mock.patch('readthedocs.doc_builder.backends.sphinx.glob'),

'docker': mock.patch('readthedocs.doc_builder.environments.Client'),
'docker': mock.patch('readthedocs.doc_builder.environments.APIClient'),
'docker_client': mock.Mock(),
}
self.mocks = {}
Expand Down
7 changes: 5 additions & 2 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ djangorestframework==3.5.4
django-vanilla-views==1.0.4
jsonfield==1.0.3

requests==2.3.0
# Fixed to 2.15.1 because incompatibility with docker client
# See: https://github.com/requests/requests/issues/4160
requests==2.15.1

slumber==0.7.1
lxml==3.3.5
defusedxml==0.5.0
Expand Down Expand Up @@ -52,7 +55,7 @@ stripe==1.20.2
django-copyright==1.0.0
django-formtools==1.0
django-dynamic-fixture==1.8.5
docker-py==1.3.1
docker==2.6.1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.7.0 is out

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from its changelog it seems to be safe to use it https://docker-py.readthedocs.io/en/stable/change-log.html#

besides, I just tested it locally and it just works

django-textclassifier==1.0
django-annoying==0.10.1
django-messages-extends==0.5
Expand Down