Commit Graph

1036 Commits

Author SHA1 Message Date
Lobsiinvok 9047263354 Add filters option to NetworkApiMixin.networks
Signed-off-by: Boik <qazbnm456@gmail.com>
2017-01-05 09:23:26 +08:00
Dmitri 59ccd8a782 Fix readonly in mounts.
Signed-off-by: Dmitri Zimine dz@stackstorm.com
2016-12-28 23:43:15 -08:00
Joffrey F 4219ebc9a1 Bump version number to next dev
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-12 14:30:21 -08:00
Joffrey F 7b8809eb07 Bump version and update Changelog
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-12 14:29:13 -08:00
Joffrey F 769ca5a76a Rename non-URL occurrences of docker-py to "Docker SDK for Python"
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-12 13:28:49 -08:00
Flavio Curella 6f239fbf29 Make resources hashable, so that they can be added to `set`s
Signed-off-by: Flavio Curella <flavio.curella@gmail.com>
2016-12-08 12:19:30 -06:00
徐俊杰 b9c48dca2c Scope is added in volume after docker 1.12
Signed-off-by: pacoxu <paco.xu@daocloud.io>

add ut test for volume scope and no specified name create
Signed-off-by: Paco Xu <paco.xu@daocloud.io>

try to fix ut failure of volume creation
Signed-off-by: Paco Xu <paco.xu@daocloud.io>

try to fix ut failure of volume creation
Signed-off-by: Paco Xu <paco.xu@daocloud.io>

Scope is added in volume after docker 1.12
 Signed-off-by: pacoxu <paco.xu@daocloud.io>

Scope is added in volume after docker 1.12
 Signed-off-by: pacoxu <paco.xu@daocloud.io>
2016-12-08 10:31:44 +08:00
Joffrey F d024b1bd78 Merge pull request #1338 from docker/remove_node
Implement swarm node removal
2016-12-07 15:37:17 -08:00
Joffrey F 281b5558b5 Merge pull request #1340 from docker/dnephin-add-attachable
Add attachable option in create_network
2016-12-07 15:36:43 -08:00
Joffrey F 738cfdcdf9 Update code and tests for Engine 1.13 compatibility
Makefile now runs tests against Docker 1.13 RC

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-07 14:51:14 -08:00
Joffrey F c239e40504 Implement swarm node removal
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-07 12:24:18 -08:00
Pavel Sviderski 2b88e9cddb increase logs performance, do not copy bytes object
Signed-off-by: Pavel Sviderski <pavel@psviderski.name>
2016-12-07 18:12:12 +08:00
Joffrey F b71f34e948 Fix typo in create_network
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-06 11:26:53 -08:00
Ryan Belgrave 16d0f96bc5
Name is not required when creating a docker volume
Signed-off-by: Ryan Belgrave <Ryan.Belgrave@target.com>
2016-12-06 10:46:02 -06:00
Ben Firshman 9050e1c6e0 Merge pull request #1339 from docker/min_version_1.21
Minimum version 1.24 -> 1.21
2016-12-06 15:50:20 +01:00
Joffrey F 993001bc49 Minimum version 1.24 -> 1.21
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-05 16:53:21 -08:00
Daniel Nephin 2b85fbf120 Add attachable.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2016-12-05 17:54:18 -05:00
Ben Firshman dd8ad21c88 Merge pull request #1272 from TomasTomecek/1271-fix-detach-in-exec-start
exec: fix running with detach=True
2016-12-05 11:00:10 +00:00
Joffrey F c02493cf18 Merge pull request #1331 from aanand/fix-auth-config-path-windows
Fix auth config path on Windows
2016-12-02 18:07:08 -08:00
Joffrey F d56b2d3dc8 Merge pull request #1315 from bfirsh/rename-docker-py-to-docker-sdk-python
Start to rename docker-py to docker-sdk-python
2016-12-02 15:20:34 -08:00
Joffrey F 32cd0161b6 Merge pull request #1330 from docker/walkerlee-master
Add options to IPAMConfig
2016-12-02 15:18:41 -08:00
Joffrey F fbc9f9b5e9 Merge pull request #1327 from docker/compose4171_build_auth_headers
Properly fill out auth headers in APIClient.build when using a credstore
2016-12-02 15:08:48 -08:00
Joffrey F 1d59aeca4b Add options to IPAMConfig
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-02 15:04:05 -08:00
Joffrey F 88b733b0f4 Merge branch 'patch-1' of https://github.com/manics/docker-py into manics-patch-1
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-02 14:50:40 -08:00
Aanand Prasad fb4969f744 Fix auth config path on Windows
The Engine client looks *only* at the USERPROFILE environment variable
on Windows, so we should do that too.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-12-02 18:02:09 +00:00
Ben Firshman dfa4b76989 Merge pull request #1328 from docker/ssladapter_transport_module
Move ssladapter to transport module
2016-12-02 14:44:03 +00:00
Joffrey F 4539644667 Move ssladapter to transport module
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-01 18:04:40 -08:00
Joffrey F d042c6aeda Properly fill out auth headers in APIClient.build when using
a credentials store

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-01 18:04:15 -08:00
Joffrey F 993f298e85 Move config type creation from docker.utils functions to classes in
docker.types

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-01 16:06:41 -08:00
Ben Firshman e7d78d10f6 Merge pull request #1303 from aanand/helpful-containers-warning
Show a helpful warning when people try to call `client.containers()`
2016-12-01 11:11:46 +00:00
Joffrey F 239673a51c Merge pull request #1308 from docker/docker_client
Rename Client -> DockerClient
2016-11-30 15:30:40 -08:00
Tomas Tomecek 515db1f6fd exec: fix running with detach=True
Fixes #1271

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2016-11-29 16:04:52 +01:00
Ben Firshman 6a16edee3e Merge pull request #1277 from bodnarbm/do-not-traverse-ignored-directories-with-no-potential-exceptions
Do not traverse excluded directories that are not prefixes of dockerignore exceptions.
2016-11-29 10:09:43 +00:00
Joffrey F f5ac10c469 Rename Client -> DockerClient
Replace references to old Client with APIClient
Moved contents of services.md to appropriate locations

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-28 15:28:04 -08:00
Joffrey F 52376e4b24 Merge pull request #1250 from mmerickel/fix/1211
do not assume that read will consume the number of bytes requested
2016-11-28 14:00:32 -08:00
Joffrey F 9643253c50 Merge pull request #1297 from docker/stepanstipl-allow_custom_pid_mode
Allow custom pid mode
2016-11-28 14:00:07 -08:00
Joffrey F 115f39e96e Merge pull request #1316 from bfirsh/add-example-for-tag
Add example for tag()
2016-11-28 13:14:02 -08:00
Joffrey F 4e08a5cb9e Merge pull request #1317 from bfirsh/fix-environment-variable-file-with-new-lines
Fix parsing for an environment file with newlines
2016-11-28 12:06:38 -08:00
Joffrey F 44e57fb95d Re-enable pid_mode checks for API < 1.24
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-28 12:01:25 -08:00
Aanand Prasad 8c27dd5233
Show a helpful warning when people try to call `client.containers()`
People upgrading to docker-py 2.0 without being aware of the new client
API will likely try to call the old `containers()` method. This adds a
helpful warning telling them to use APIClient to get the old API.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-11-28 19:43:49 +00:00
Stepan Stipl 7ef48c3769 Allow custom PID mode for the container
Docker added support for sharing PID namespaces with other containers
since version 1.12 (see https://github.com/docker/docker/pull/22481).

Signed-off-by: Stepan Stipl <stepan@stipl.net>
2016-11-28 11:42:00 -08:00
Jon Cotton 4a7c772daf
Fix parsing for an environment file with newlines
Fixes the new, purposely broken test added in the previous commit.

Signed-off-by: Jon Cotton <jc@finaltransfer.net>
2016-11-28 19:41:13 +00:00
Ben Firshman 29215a0ad9
Add example for tag()
Carrying #1120. Thanks @Faylixe!

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-28 19:38:29 +00:00
Michael Merickel dbd704e68d do not assume that read will consume the number of bytes requested
The issue is that ``os.read`` does not always read the expected number of
bytes, and thus we are moving to the next frame too early causing drift
in the byte stream. When the reading drifts, it starts reading garbage
as the next frame size. The some examples of frame sizes were
4032897957 bytes, etc. Values this large were causing the exceptions
from ``os.read``.

fixes #1211

Signed-off-by: Michael Merickel <michael@merickel.org>
2016-11-28 13:31:12 -06:00
Joffrey F f36c28926c Merge pull request #1305 from bfirsh/update-setup-py
Update setup.py and things
2016-11-28 11:29:42 -08:00
Joffrey F 5eacb986d7
Remove support for host_config in Client.start
Any additional arguments passed to start will raise a
DeprecatedMethod (DockerException) exception.

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-28 18:34:09 +00:00
Ben Firshman 94083f25ac
Start to rename docker-py to docker-sdk-python
Pretty much everything except renaming the GitHub repo and
documentation, which is not actually done yet. Nearer the release
we can do a search/replace for all that stuff.

Ref #1310

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-28 16:45:59 +00:00
Ben Firshman fc9f7e2b2f
Bump version to 2.0.0-dev
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-28 15:11:01 +00:00
Brandon Bodnar e2eb4a3158 Prevent traversing excluded directories with no possible dockerignore exceptions
Fixes an issue where all files in a rather large excluded folder are traversed and examined when creating the build context for potential exception to the exclusion, even though the exclusion rule is for a completely unrelated folder.

Signed-off-by: Brandon Bodnar <bodnarbm@gmail.com>
2016-11-26 21:17:18 -05:00
Joffrey F 8478491cf8 Merge pull request #1186 from bfirsh/two-point-oh
A new user-focused API
2016-11-22 16:41:52 -08:00
biniambekele a38644fc0e Fix ContainerApiMixin.copy with dict container arg
Signed-off-by: biniambekele <biniambekele@users.noreply.github.com>
2016-11-22 15:17:45 -05:00
Ben Firshman b5f7d380d0
Add helpful error for APIClient methods on Client
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:05:43 +00:00
Ben Firshman 1984f68730
Add new user-focused API
See #1086

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:05:43 +00:00
Ben Firshman f32c0c1709
Add docstrings to low-level API
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:04 +00:00
Ben Firshman dac7174ff2
Make ping return bool instead of string
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:03 +00:00
Ben Firshman 9daa320454
Rename Client to APIClient
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:03 +00:00
Ben Firshman c7903f084e
Remove AutoVersionClient
Just do Client(version='auto').

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:03 +00:00
Ben Firshman b49cacced0
Make docker.utils.ports a single file
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:03 +00:00
Ben Firshman 19eefcf705
Make docker.ssladaptor a single file
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:03 +00:00
Ben Firshman 2c9d1110f0
Make docker.auth a single file
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:03 +00:00
Ben Firshman 81dfc475b3
Drop support for API versions <1.24
Implemented as just a warning. Actual removal of code will follow
sometime in the future.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:01 +00:00
Joffrey F f12b618ee9 Merge pull request #1236 from docker/host_config_isolation
Add support for isolation param in host config
2016-11-17 17:42:57 -08:00
Aanand Prasad e4b6d0dca6 Convert dicts to Healthcheck objects, string commands to CMD-SHELL lists
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2016-11-16 16:04:17 +00:00
Jamie Greeff b4f2b5fa70 Add support for passing healthcheck to create_container
Signed-off-by: Jamie Greeff <jamie@greeff.me>
2016-11-16 16:04:17 +00:00
Simon Li 6fad0855b5 Use format_environment to convert env in ContainerSpec
Signed-off-by: Simon Li <orpheus+devel@gmail.com>
2016-11-11 16:11:18 +00:00
bin liu d6ffe9aa0d fix JSON key typo, it should not be underscores, but should be camelCase with first letter capital
Signed-off-by: bin liu <liubin0329@gmail.com>
2016-11-11 20:19:43 +08:00
Ryan Belgrave 98e2e1fcd6
Add labels and shmsize arguments to the image build
Signed-off-by: Ryan Belgrave <Ryan.Belgrave@target.com>
2016-11-08 09:45:32 -06:00
Joffrey F f745c8e7c5 Merge pull request #1230 from LabattFoodService/updateNode
enable setting of node labels #1225
2016-11-07 10:47:55 -08:00
Joffrey F 3ac73a285b Fix endpoint spec and networks params in update_service
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-04 15:10:12 -07:00
Joffrey F be2ae8df36 WIP
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-04 15:10:12 -07:00
Joffrey F 422bc2beb2 Fix NpipeSocket.settimeout to match expected behavior
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-02 16:28:23 -07:00
Joffrey F 163a1ce371 Implement retry logic when the npipe open procedure fails
with ERROR_PIPE_BUSY

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-26 18:04:25 -07:00
Joffrey F 9b35c74f0e Fix dockerignore exclusion logic on Windows
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-14 16:02:28 -07:00
Joffrey F 9fc06b197b Merge pull request #1254 from docker/npipe-advanced
Several fixes to npipe support
2016-10-14 16:01:53 -07:00
Joffrey F 14634fb50a Merge pull request #1256 from docker/format_env_unicode_bug
Do not break when calling format_environment with unicode values
2016-10-13 12:39:47 -07:00
Joffrey F 3566e7c2f3 Merge pull request #1255 from docker/base_url_trailing_slash
Remove trailing slashes in result of utils.parse_host
2016-10-13 12:39:22 -07:00
Ben Firshman 6768477edf
Remove dead code in import_image_from_data
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-10-13 10:48:32 +02:00
Joffrey F 059f61bf5a Do not break when calling format_environment with unicode values
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-12 17:52:43 -07:00
Joffrey F 05f1060824 Remove trailing slashes in result of utils.parse_host
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-12 16:06:43 -07:00
Joffrey F c76ec15d9b Several fixes to npipe support
- Fix _get_raw_response_socket to always return the NpipeSocket object
- Override NpipeHTTPConnectionPool._get_conn to avoid crash in urllib3
- Fix NpipeSocket.recv_into for Python 2
- Do not call select() on NpipeSocket objects

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-12 13:23:27 -07:00
Joffrey F 6f7392ea09 Do not allow bufsize to be 0 in NpipeSocket.makefile()
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-11 15:16:43 -07:00
Joffrey F b65de73afe Update adapters to use pool_connections instead of num_pools
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-10-04 12:19:33 -07:00
Pierre Tardy 8239032463
fix for got an unexpected keyword argument 'num_pools'
requests's HTTPAdapter API is pool_connections for number of connection of the pool

Signed-off-by: Pierre Tardy <tardyp@gmail.com>
2016-10-04 13:13:31 +02:00
Ben Firshman 8cb186b623
Add timeout to from_env
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-10-03 11:58:08 +01:00
Joffrey F 49997d040b Add support for isolation param in host config
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-29 16:34:36 -07:00
Joffrey F 2b34e0b8e4 Merge pull request #1224 from mferon/addRestartPolicyUpdateSupport
Add support for restart policy update
2016-09-29 14:53:53 -07:00
徐俊杰 65ad1545e8 replace on_failure with on-failure
Signed-off-by:  徐俊杰<roollingstone@gmail.com>
Signed-off-by: XuPaco <roollingstone@gmail.com>
2016-09-29 11:01:51 +08:00
Maxime Feron a665c8c443 Add support for restart policy update
Signed-off-by: Maxime Feron <maxime.feron@corp.ovh.com>
2016-09-28 10:21:59 +02:00
Christian Bundy a718ab690e
Pass file object to Tarfile.addfile()
This resolves an issue where TarFile.gettarinfo() doesn't include the
file object, meaning that TarFile.addfile(TarFile.gettarinfo()) doesn't
pass the test suite. Instead, this uses an open() within a try...except
block to include a file object for each file without passing a file
object when the path is a directory.

Signed-off-by: Christian Bundy <christianbundy@fraction.io>
2016-09-27 21:39:30 +00:00
Nathan Shirlberg 6ef14932d0 enable setting of node labels #1225
Added update_node function to enable setting labels on nodes.  This
exposes the Update a Node function from the Docker API and should
enable promoting/demoting manager nodes inside a swarm.

Signed-off-by: Nathan Shirlberg <nshirlberg@labattfood.com>
2016-09-27 11:26:26 -05:00
Sebastian Schwarz cbd2ba52af 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>
2016-09-27 00:11:31 +00:00
Joffrey F 1e939be5fb Merge pull request #1210 from docker/identity-token-support
Add support for identity tokens in config file
2016-09-16 11:47:48 -07:00
Joffrey F d731a4315c Add support for identity tokens in config file.
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-15 14:28:09 -07:00
Joffrey F 9141e9496d Merge pull request #1215 from bfirsh/autopep8
Fix a few pep8 issues
2016-09-14 14:08:13 -07:00
Joffrey F 230bc18bfd Merge pull request #1208 from docker/1207-configurable-num-pools
Number of pools in adapter is configurable
2016-09-14 11:10:25 -07:00
Joffrey F 89afee94fd Merge pull request #1213 from bfirsh/parse-json-errors
Parse JSON API errors
2016-09-14 11:09:55 -07:00
Ben Firshman 6220636536
Fix a few pep8 issues
autopep8 --in-place --recursive --experimental -aaa --ignore E309 .

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-09-14 16:54:54 +01:00
Ben Firshman ca51ad29a5
Ignore not in swarm error when force leaving
Real errors were getting swallowed in these tests, producing
other confusing cascading errors. This makes it much easier to
make sure a node is not in a Swarm, while also handling other
errors correctly.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-09-14 16:00:03 +01:00
Ben Firshman dcd01f0f48
Parse JSON API errors
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-09-14 14:54:40 +01:00
Joffrey F be7d0f0184 Number of pools in adapter is configurable
Default increased from 10 to 25

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-09-12 17:43:50 -07:00