Skip to content

Commit

Permalink
Merge pull request #1190 from docker/1.10.0-release
Browse files Browse the repository at this point in the history
1.10.0 release
  • Loading branch information
shin- authored Sep 9, 2016
2 parents dc164c7 + 3eb93f6 commit e045331
Show file tree
Hide file tree
Showing 57 changed files with 2,520 additions and 478 deletions.
9 changes: 9 additions & 0 deletions Dockerfile-docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:2.7

RUN mkdir /home/docker-py
WORKDIR /home/docker-py

COPY docs-requirements.txt /home/docker-py/docs-requirements.txt
RUN pip install -r docs-requirements.txt

COPY . /home/docker-py
13 changes: 1 addition & 12 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,7 @@

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2016 Docker, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
51 changes: 40 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,48 +1,77 @@
.PHONY: all build test integration-test unit-test build-py3 unit-test-py3 integration-test-py3

.PHONY: all
all: test

.PHONY: clean
clean:
rm -rf tests/__pycache__
rm -rf tests/*/__pycache__
docker rm -vf dpy-dind
-docker rm -vf dpy-dind
find -name "__pycache__" | xargs rm -rf

.PHONY: build
build:
docker build -t docker-py .

.PHONY: build-py3
build-py3:
docker build -t docker-py3 -f Dockerfile-py3 .

.PHONY: build-docs
build-docs:
docker build -t docker-py-docs -f Dockerfile-docs .

.PHONY: build-dind-certs
build-dind-certs:
docker build -t dpy-dind-certs -f tests/Dockerfile-dind-certs .

.PHONY: test
test: flake8 unit-test unit-test-py3 integration-dind integration-dind-ssl

.PHONY: unit-test
unit-test: build
docker run docker-py py.test tests/unit

.PHONY: unit-test-py3
unit-test-py3: build-py3
docker run docker-py3 py.test tests/unit

.PHONY: integration-test
integration-test: build
docker run -v /var/run/docker.sock:/var/run/docker.sock docker-py py.test tests/integration

.PHONY: integration-test-py3
integration-test-py3: build-py3
docker run -v /var/run/docker.sock:/var/run/docker.sock docker-py3 py.test tests/integration

.PHONY: integration-dind
integration-dind: build build-py3
docker rm -vf dpy-dind || :
docker run -d --name dpy-dind --privileged dockerswarm/dind:1.10.3 docker daemon -H tcp://0.0.0.0:2375
docker run --env="DOCKER_HOST=tcp://docker:2375" --link=dpy-dind:docker docker-py py.test tests/integration
docker run --env="DOCKER_HOST=tcp://docker:2375" --link=dpy-dind:docker docker-py3 py.test tests/integration
docker run -d --name dpy-dind --privileged dockerswarm/dind:1.12.0 docker daemon\
-H tcp://0.0.0.0:2375
docker run --env="DOCKER_HOST=tcp://docker:2375" --link=dpy-dind:docker docker-py\
py.test tests/integration
docker run --env="DOCKER_HOST=tcp://docker:2375" --link=dpy-dind:docker docker-py3\
py.test tests/integration
docker rm -vf dpy-dind

.PHONY: integration-dind-ssl
integration-dind-ssl: build-dind-certs build build-py3
docker run -d --name dpy-dind-certs dpy-dind-certs
docker run -d --env="DOCKER_HOST=tcp://localhost:2375" --env="DOCKER_TLS_VERIFY=1" --env="DOCKER_CERT_PATH=/certs" --volumes-from dpy-dind-certs --name dpy-dind-ssl -v /tmp --privileged dockerswarm/dind:1.10.3 docker daemon --tlsverify --tlscacert=/certs/ca.pem --tlscert=/certs/server-cert.pem --tlskey=/certs/server-key.pem -H tcp://0.0.0.0:2375
docker run --volumes-from dpy-dind-ssl --env="DOCKER_HOST=tcp://docker:2375" --env="DOCKER_TLS_VERIFY=1" --env="DOCKER_CERT_PATH=/certs" --link=dpy-dind-ssl:docker docker-py py.test tests/integration
docker run --volumes-from dpy-dind-ssl --env="DOCKER_HOST=tcp://docker:2375" --env="DOCKER_TLS_VERIFY=1" --env="DOCKER_CERT_PATH=/certs" --link=dpy-dind-ssl:docker docker-py3 py.test tests/integration
docker run -d --env="DOCKER_HOST=tcp://localhost:2375" --env="DOCKER_TLS_VERIFY=1"\
--env="DOCKER_CERT_PATH=/certs" --volumes-from dpy-dind-certs --name dpy-dind-ssl\
-v /tmp --privileged dockerswarm/dind:1.12.0 docker daemon --tlsverify\
--tlscacert=/certs/ca.pem --tlscert=/certs/server-cert.pem\
--tlskey=/certs/server-key.pem -H tcp://0.0.0.0:2375
docker run --volumes-from dpy-dind-ssl --env="DOCKER_HOST=tcp://docker:2375"\
--env="DOCKER_TLS_VERIFY=1" --env="DOCKER_CERT_PATH=/certs"\
--link=dpy-dind-ssl:docker docker-py py.test tests/integration
docker run --volumes-from dpy-dind-ssl --env="DOCKER_HOST=tcp://docker:2375"\
--env="DOCKER_TLS_VERIFY=1" --env="DOCKER_CERT_PATH=/certs"\
--link=dpy-dind-ssl:docker docker-py3 py.test tests/integration
docker rm -vf dpy-dind-ssl dpy-dind-certs

.PHONY: flake8
flake8: build
docker run docker-py flake8 docker tests

.PHONY: docs
docs: build-docs
docker run -v `pwd`/docs:/home/docker-py/docs/ -p 8000:8000 docker-py-docs mkdocs serve -a 0.0.0.0:8000
14 changes: 0 additions & 14 deletions docker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Copyright 2013 dotCloud inc.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .version import version, version_info

__version__ = version
Expand Down
4 changes: 3 additions & 1 deletion docker/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
from .daemon import DaemonApiMixin
from .exec_api import ExecApiMixin
from .image import ImageApiMixin
from .volume import VolumeApiMixin
from .network import NetworkApiMixin
from .service import ServiceApiMixin
from .swarm import SwarmApiMixin
from .volume import VolumeApiMixin
6 changes: 3 additions & 3 deletions docker/api/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def build(self, path=None, tag=None, quiet=False, fileobj=None,
custom_context=False, encoding=None, pull=False,
forcerm=False, dockerfile=None, container_limits=None,
decode=False, buildargs=None, gzip=False):
remote = context = headers = None
remote = context = None
headers = {}
container_limits = container_limits or {}
if path is None and fileobj is None:
raise TypeError("Either path or fileobj needs to be provided.")
Expand Down Expand Up @@ -134,8 +135,7 @@ def _set_auth_headers(self, headers):
', '.join(repr(k) for k in self._auth_configs.keys())
)
)
if headers is None:
headers = {}

if utils.compare_version('1.19', self._version) >= 0:
headers['X-Registry-Config'] = auth.encode_header(
self._auth_configs
Expand Down
25 changes: 20 additions & 5 deletions docker/api/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@ def attach(self, container, stdout=True, stderr=True,
'logs': logs and 1 or 0,
'stdout': stdout and 1 or 0,
'stderr': stderr and 1 or 0,
'stream': stream and 1 or 0,
'stream': stream and 1 or 0
}

headers = {
'Connection': 'Upgrade',
'Upgrade': 'tcp'
}

u = self._url("/containers/{0}/attach", container)
response = self._post(u, params=params, stream=stream)
response = self._post(u, headers=headers, params=params, stream=stream)

return self._get_result(container, stream, response)
return self._read_from_socket(response, stream)

@utils.check_resource
def attach_socket(self, container, params=None, ws=False):
Expand All @@ -34,9 +40,18 @@ def attach_socket(self, container, params=None, ws=False):
if ws:
return self._attach_websocket(container, params)

headers = {
'Connection': 'Upgrade',
'Upgrade': 'tcp'
}

u = self._url("/containers/{0}/attach", container)
return self._get_raw_response_socket(self.post(
u, None, params=self._attach_params(params), stream=True))
return self._get_raw_response_socket(
self.post(
u, None, params=self._attach_params(params), stream=True,
headers=headers
)
)

@utils.check_resource
def commit(self, container, repository=None, tag=None, message=None,
Expand Down
14 changes: 10 additions & 4 deletions docker/api/exec_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ def exec_resize(self, exec_id, height=None, width=None):
def exec_start(self, exec_id, detach=False, tty=False, stream=False,
socket=False):
# we want opened socket if socket == True
if socket:
stream = True
if isinstance(exec_id, dict):
exec_id = exec_id.get('Id')

Expand All @@ -66,10 +64,18 @@ def exec_start(self, exec_id, detach=False, tty=False, stream=False,
'Detach': detach
}

headers = {} if detach else {
'Connection': 'Upgrade',
'Upgrade': 'tcp'
}

res = self._post_json(
self._url('/exec/{0}/start', exec_id), data=data, stream=stream
self._url('/exec/{0}/start', exec_id),
headers=headers,
data=data,
stream=True
)

if socket:
return self._get_raw_response_socket(res)
return self._get_result_tty(stream, res, tty)
return self._read_from_socket(res, stream)
Loading

0 comments on commit e045331

Please sign in to comment.