Commit Graph

308 Commits

Author SHA1 Message Date
Joffrey F 7a28cad58e Don't descend into symlinks when building context tar
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-21 14:20:41 +01:00
Joffrey F 33f1ca9a48 Use same split rules for Dockerfile as other include/exclude patterns
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-14 14:11:42 -07:00
Joffrey F 9b8e022fa1
Merge pull request #1928 from mnottale/fix-spurious-resolution-macos-slowdown
Workaround requests resolving our unix socket URL on macosx.
2018-02-27 08:58:59 -08:00
Joffrey F fe966764ef
Merge pull request #1927 from mefyl/master
Add test for "/.." patterns in .dockerignore.
2018-02-26 10:53:41 -08:00
Matthieu Nottale 15c26e7057 Workaround requests resolving our unix socket URL on macosx.
Signed-off-by: Matthieu Nottale <matthieu.nottale@docker.com>
2018-02-26 14:47:26 +01:00
mefyl 4295919103
Add test for "/.." patterns in .dockerignore.
Signed-off-by: mefyl <quentin.hocquet@docker.com>
2018-02-26 12:59:46 +01:00
Joffrey F 9a4cc53c52 Merge branch 'release' into 3.1.0-release
Signed-off-by: Joffrey F <joffrey@docker.com>

Conflicts:
	docker/version.py
	tests/unit/api_test.py
	tests/unit/utils_test.py
2018-02-22 13:36:15 -08:00
mefyl bb3ad64060
Fix .dockerignore: accept wildcard in inclusion pattern, honor last line precedence.
Signed-off-by: mefyl <quentin.hocquet@docker.com>
2018-02-21 17:05:26 +01:00
mefyl c8f5a5ad40
Fix dockerignore handling of absolute path exceptions.
Signed-off-by: mefyl <quentin.hocquet@docker.com>
2018-02-21 17:05:26 +01:00
mefyl 181c1c8eb9 Revert "Correctly support absolute paths in .dockerignore"
This reverts commit 34d50483e2.

Signed-off-by: mefyl <quentin.hocquet@docker.com>
2018-02-19 13:37:35 +01:00
Joffrey F 4c708f568c Fix test_login flakes
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-14 16:22:33 -08:00
Joffrey F 08803743c5
Merge pull request #1906 from docker/1352-data_stream_control
Add chunk_size parameter to data downloading methods
2018-02-14 16:22:02 -08:00
Joffrey F 581ccc9f7e Add chunk_size parameter to data downloading methods (export, get_archive, save)
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-14 16:07:19 -08:00
Joffrey F 3498b63fb0 Fix authconfig resolution when credStore is used combined with login()
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-13 18:55:56 -08:00
Joffrey F 34d50483e2 Correctly support absolute paths in .dockerignore
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-12 14:59:41 -08:00
Joffrey F 6de7bab22f Rewrite access check in create_archive with EAFP
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-05 13:38:32 -08:00
Joffrey F 539b321bd1 Add login data to the right subdict in auth_configs
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-05 13:38:19 -08:00
Joffrey F a60011ca3a Add workaround for bpo-32713
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-05 13:38:03 -08:00
Joffrey F 7c19772eb6
Merge pull request #1901 from docker/1899-create_archive_fix
Rewrite access check in create_archive with EAFP
2018-02-05 13:37:01 -08:00
Joffrey F 58639aecfa Rewrite access check in create_archive with EAFP
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-05 13:11:19 -08:00
Joffrey F 855b71eabe
Merge pull request #1896 from docker/1895-login-auths
Add login data to the right subdict in auth_configs
2018-02-02 10:29:33 -08:00
Joffrey F 04bf470f6e Add workaround for bpo-32713
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-01 16:51:36 -08:00
Joffrey F 83d185d695 Add login data to the right subdict in auth_configs
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-01 16:02:09 -08:00
Joffrey F 7fabcdaa4c Update wait to always return a dict
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-31 16:52:26 -08:00
Joffrey F ea44212969
Merge pull request #1888 from docker/1884-create_volumes_win32
Correctly parse volumes with Windows paths
2018-01-31 15:25:49 -08:00
Joffrey F 209ae2423d Correctly parse volumes with Windows paths
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-31 15:12:15 -08:00
Joffrey F df8422d079 Refuse API version < 1.21 ; Remove associated code paths
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-31 14:42:01 -08:00
Joffrey F 5347c168d0 Add support for publish mode for endpointspec ports
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-31 12:42:11 -08:00
Joffrey F ccbde11c8d Improve separation between auth_configs and general_configs
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-30 18:42:38 -08:00
Fumiaki MATSUSHIMA dd858648a0 Use config.json for detachKeys
Signed-off-by: Fumiaki Matsushima <mtsmfm@gmail.com>
2018-01-30 17:16:23 -08:00
Joffrey F 17aa31456d Properly support pulling all tags in DockerClient.images.pull
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-30 16:47:04 -08:00
Joffrey F a05922e949
Merge pull request #1881 from docker/pytest-asserts
Use pytest asserts
2018-01-30 16:29:07 -08:00
Joffrey F 3422211309 Use pytest asserts
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-30 14:26:24 -08:00
Joffrey F 4e34300379 Do not break when archiving broken symlinks
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-29 18:27:12 -08:00
Joffrey F 6e6eaece81 Return tuple instead of dict in exec_run
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-26 14:21:23 -08:00
Joffrey F b0cc4b5520 Merge branch 'add_exit_code_to_exec_run' of https://github.com/hnq90/docker-py into hnq90-add_exit_code_to_exec_run 2018-01-26 14:13:15 -08:00
Joffrey F abd60aedc7 Bump default API version to 1.35
Add ContainerSpec.isolation support
Add until support in logs
Add condition support in wait
Add workdir support in exec_create

Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-26 13:56:01 -08:00
Joffrey F f95b958429 Add support for experimental platform flag in build and pull
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-23 16:59:09 -08:00
Joffrey F ac68a36a89
Merge pull request #1727 from mbelang/join-swarn-default-listen-address
Add join_swarm default listen address
2017-12-18 17:16:41 -08:00
Joffrey F 5736436966
Merge pull request #1828 from pkit/fix_error_from_httpex
fixes create_api_error_from_http_exception()
2017-12-18 14:26:47 -08:00
Constantine Peresypkin b20f800db6 fixes create_api_error_from_http_exception()
`create_api_error_from_http_exception()` is never tested in the original code
and will fail miserably when fed with empty `HTTPError` object
see fixes in requests for this behaviour: https://github.com/requests/requests/pull/3179

Signed-off-by: Constantine Peresypkin <pconstantine@gmail.com>
2017-12-18 17:15:48 +02:00
Joffrey F 6b8dfe4249 Retrieve container logs before container exits / is removed
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-12-14 16:53:44 -08:00
Joffrey F 8cfd4cb39f
Merge pull request #1807 from rycus86/update_service_from_prev_spec
Update service from prev spec
2017-12-14 12:44:36 -08:00
Joffrey F d7bc8ac2b8 Merge branch 'master' of https://github.com/tz70s/docker-py into tz70s-master
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-12-13 18:50:07 -08:00
Viktor Adam 36ed843e2b Only allow greedy queries on the model
Signed-off-by: Viktor Adam <rycus86@gmail.com>
2017-11-21 21:59:11 +00:00
Viktor Adam 7829b728a4 Fetch network details with network lists greedily
Signed-off-by: Viktor Adam <rycus86@gmail.com>
2017-11-16 23:15:31 +00:00
Viktor Adam b2d08e64bc Service model update changes
Signed-off-by: Viktor Adam <rycus86@gmail.com>
2017-11-14 23:32:19 +00:00
HuyNQ 436306f09d
Add exit code to exec_run
Signed-off-by: HuyNQ <huy@huynq.net>
2017-11-13 14:11:21 +07:00
Joffrey F 7107e265b1 Do not interrupt streaming when encountering 0-length frames
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-11-07 15:18:26 -08:00
Maxime Belanger 7fa2cb7be3 Add join_swarm default listen address
Since the docker CLI adds a default listen address (0.0.0.0:2377)
when joining a node to the swarm, the docker-py api will support
the same behavior to easy configuration.

Signed-off-by: Maxime Belanger <maxime.b.belanger@gmail.com>
2017-08-29 08:38:16 -04:00
Veli-Matti Lintu fc6773d673 Commit d798afca made changes for the handling of '**' patterns in
.dockerignore. This causes an IndexError with patterns ending
with '**', e.g. 'subdir/**'. This adds a missing boundary check
before checking for trailing '/'.

Signed-off-by: Veli-Matti Lintu <veli-matti.lintu@nosto.com>
2017-08-22 17:00:11 -07:00
Veli-Matti Lintu 3df0653493 Commit d798afca made changes for the handling of '**' patterns in
.dockerignore. This causes an IndexError with patterns ending
with '**', e.g. 'subdir/**'. This adds a missing boundary check
before checking for trailing '/'.

Signed-off-by: Veli-Matti Lintu <veli-matti.lintu@nosto.com>
2017-08-21 12:01:50 -07:00
Joffrey F d9df2a8b75 Fix handling of non-multiplexed (TTY) streams over upgraded sockets
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-08-17 13:38:40 -07:00
David Steines 6b59dc6271 Allow detach and remove for api version >= 1.25 and use auto_remove when both are set. Continue raising an exception for api versions <1.25.
Signed-off-by: David Steines <d.steines@gmail.com>
2017-08-17 13:38:40 -07:00
Joffrey F 7f5739dc02 Leading slash in .dockerignore should be ignored
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-08-17 13:38:40 -07:00
Joffrey F 7139e2d8f1 Return generator for output of load_image endpoint
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-08-17 13:38:40 -07:00
Artem Bolshakov 62fda980e4 client.containers.run returns None if none of json-file or journald logging drivers used
Signed-off-by: Artem Bolshakov <either.free@gmail.com>
2017-08-17 13:38:40 -07:00
Jakub Goszczurny bf9d06db25 Generating regexp from .dockerignore file in a similar way as docker-ce.
Signed-off-by: Jakub Goszczurny <szczurmys@o2.pl>
2017-08-17 13:38:40 -07:00
Matthew Berry a23cd3d8e8 Fix #1673 check resource error in container network API
Container network functions checked 'image' as resource ID and not
'container'.  This caused a traceback when using container as named
argument.

Signed-off-by: Matthew Berry <mtberry89@gmail.com>
2017-08-17 13:38:40 -07:00
Joffrey F 13b9349216 Fix handling of non-multiplexed (TTY) streams over upgraded sockets
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-08-17 12:02:59 -07:00
David Steines e17a545aa5 Allow detach and remove for api version >= 1.25 and use auto_remove when both are set. Continue raising an exception for api versions <1.25.
Signed-off-by: David Steines <d.steines@gmail.com>
2017-08-15 17:38:34 -07:00
Joffrey F 92a2e48e17 Leading slash in .dockerignore should be ignored
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-08-15 15:40:16 -07:00
Joffrey F 5e4a69bbda Return generator for output of load_image endpoint
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-08-15 14:58:29 -07:00
Tzu-Chiao Yeh d74f1bc380 Fix #1575 - Add cpu_rt_period and cpu_rt_runtime args
Add cpu_rt_period and cpu_rt_runtime in hostconfig with version(1.25), types(int) checks.
Also add version and type checks in dockertype unit test.

Signed-off-by: Tzu-Chiao Yeh <su3g4284zo6y7@gmail.com>
2017-08-13 09:01:50 +00:00
Artem Bolshakov b8fd821336 client.containers.run returns None if none of json-file or journald logging drivers used
Signed-off-by: Artem Bolshakov <either.free@gmail.com>
2017-08-07 12:02:02 -07:00
Jakub Goszczurny d798afca7e Generating regexp from .dockerignore file in a similar way as docker-ce.
Signed-off-by: Jakub Goszczurny <szczurmys@o2.pl>
2017-08-01 13:47:45 -07:00
Matthew Berry c9960c78b0 Fix #1673 check resource error in container network API
Container network functions checked 'image' as resource ID and not
'container'.  This caused a traceback when using container as named
argument.

Signed-off-by: Matthew Berry <mtberry89@gmail.com>
2017-07-14 09:31:16 -07:00
Joffrey F 50a60717f0 split_port should not break when passed a non-string argument
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-06-28 12:22:34 -07:00
Joffrey F a8722fb0c2 split_port should not break when passed a non-string argument
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-06-28 12:06:03 -07:00
Joffrey F 320c810471 Support credHelpers section in config.json
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-06-22 11:51:31 -07:00
Joffrey F 87d5cd1b0a Merge pull request #1632 from kaiyou/master
allow ipv6 :: notation in split_port (using re)
2017-06-16 11:57:52 -07:00
Chris Mark c03a009e2d
Raising error in case of invalid value of since kwarg on Container.logs
Signed-off-by: Chris Mark <chrismarkou92@gmail.com>
2017-06-16 18:30:24 +03:00
grahamlyons ee75a1c2e3 Ensure default timeout is used by API Client
The `from_env` method on the `docker` module passed `None` as the
value for the `timeout` keyword argument which overrode the default
value in the initialiser, taken from `constants` module.

This sets the default in the initialiser to `None` and adds logic
to set that, in the same way that `version` is handled.

Signed-off-by: grahamlyons <graham@grahamlyons.com>
2017-06-08 14:39:17 +01:00
kaiyou 0c1271350d Add a specific unit test for splitting port with IPv6
The test was copied from ccec87ca2c

Signed-off-by: kaiyou <pierre@jaury.eu>
2017-06-05 18:21:33 +02:00
Joffrey F 95297dc2e7 Replace erroneous networks argument in containers.run with singular
network equivalent.

Small docfixes

Signed-off-by: Joffrey F <joffrey@docker.com>
2017-05-12 14:28:27 -07:00
Joffrey F c6ddea469f Include tag in images.get after pulling if provided separately
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-05-09 12:24:40 -07:00
Joffrey F f27ecf3f88 Add ContainerSpec mounts test
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-05-08 14:13:59 -07:00
Joffrey F 13dfb13858 Merge branch 'add-env-support-to-exec' of https://github.com/TomasTomecek/docker-py into TomasTomecek-add-env-support-to-exec
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-05-02 16:38:40 -07:00
Dan Liew 2a0a7adece Fix typo s/CpuSetCpus/CpusetCpus/
According to Docker's API documentation [1]. The parameter name
is `CpusetCpus` not `CpuSetCpus`.

[1] https://docs.docker.com/engine/api/v1.25/#operation/ContainerCreate

Signed-off-by: Dan Liew <daniel.liew@imperial.ac.uk>
2017-05-01 14:56:40 +01:00
Dan Liew b9ca8755bb Add missing support for `CpusetMems` parameter to HostConfig.
Signed-off-by: Dan Liew <daniel.liew@imperial.ac.uk>
2017-05-01 14:56:40 +01:00
Tomas Tomecek 4633dac580 exec: add support for `Env`
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2017-04-29 08:56:51 +02:00
Joffrey F 72b9b72359 Merge pull request #1570 from AlexeyRokhin/master
Add cpu_count, cpu_percent, nano_cpus parameters to container HostConfig.
2017-04-28 14:16:25 -07:00
Alexey Rokhin c2f83d558e cpus renamed to nano_cpus. Type and scale of nano_cpus are changed. Comments for new parameters are changed.
Signed-off-by: Alexey Rokhin <arokhin@mail.ru>
2017-04-28 15:55:44 +03:00
Joffrey F d19572aae3 Merge pull request #1493 from funkyfuture/model_properties
Adds a few model properties
2017-04-27 16:21:02 -07:00
Rob Kooper 5f9a599b0f Fix if replicas is set to 0, Fixes #1572
Signed-off-by: Rob Kooper <kooper@illinois.edu>
2017-04-26 22:50:17 -05:00
Alexey Rokhin 3f7d622143 Add cpu_count, cpu_percent, cpus parameters to container HostConfig.
Signed-off-by: Alexey Rokhin <arokhin@mail.ru>
2017-04-19 15:07:02 +03:00
Frank Sachsenheim 659090fc99 Adds an 'image' property to the container model
Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
2017-04-15 15:46:52 +02:00
Frank Sachsenheim b585ec59a8 Adds a 'labels' property to the image model
Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
2017-04-15 15:46:52 +02:00
Frank Sachsenheim 1cd56b9f0c Adds a 'labels' property to the container model
The Docker API seems to respond with a 'null' value for the 'Labels'
attribute from containers that were created with older Docker versions.
An empty dictionary is returned in this case.

Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
2017-04-15 15:46:52 +02:00
Joffrey F 79edcc28f7 Add support for volume_driver in HostConfig
Some cleanup in ContainerConfig + warning if volume_driver is provided (API>1.20)

Signed-off-by: Joffrey F <joffrey@docker.com>
2017-04-05 17:05:08 -07:00
Joffrey F 73d8097b3d Fix test issues
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-03-29 15:39:48 -07:00
Joffrey F c5d35026ce Set infinite timeout for the `events` method
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-03-27 15:57:36 -07:00
alex-dr e0e7404380 Fix APIError status_code property for client/server errors
requests.Response objects evaluate as falsy when the status_code
attribute is in the 400-500 range. Therefore we are assured that
prior to this change, APIError would show `is_server_error() == False`
when generated with a 500-level response and `is_client_error() == False`
when generated with a 400-level response. This is not desirable.

Added some seemingly dry (not DRY) unit tests to ensure nothing silly
slips back in here.

Signed-off-by: alex-dr <alex@datarobot.com>
2017-03-22 00:49:07 -04:00
Joffrey F 54b3c364cb Raise an error when passing an empty string to split_port
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-03-09 16:12:48 -08:00
Lei Gong eba20084f6 fix: Missing exception handling in split_port when no container port
"localhost:host_port:" case will raise TypeError exception directly

Catch the "TypeError" and give proper error message

* docker/utils/ports.py

Signed-off-by: Lei Gong <xue177125184@gmail.com>
2017-03-09 16:28:34 +08:00
Joffrey F f387ae46d7 Merge pull request #1467 from crierr/master
Allow port range like 8000-8010:80
2017-02-22 15:27:42 -08:00
Joffrey F f9f77c4c2f Merge pull request #1473 from Anvil/event-http-headers
Allow events daemon command to read config.json
2017-02-21 12:11:58 -08:00
Damien Nadé f36ef399ad Fixed events command related unit tests by passing a timeout value
Signed-off-by: Damien Nadé <github@livna.org>
2017-02-21 18:21:10 +01:00
crierr cfc11515bc Allow port range like 8000-8010:80
Signed-off-by: SeungJin Oh <crierr@naver.com>
2017-02-20 02:09:33 +09:00
Nils Krabshuis 44c31e47e0 Add ability to set 'Hostname' on a Service.
Signed-off-by: Nils Krabshuis <nils.krabshuis@redwood.com>
2017-02-19 06:18:26 +01:00