Commit Graph

3307 Commits

Author SHA1 Message Date
Mariano Scazzariello e011ff5be8
More sanity checking of EndpointConfig params
Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
2023-05-07 12:40:08 +02:00
Mariano Scazzariello 7870503c52
Fix case when "network_config" is not passed
Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
2023-05-07 12:15:32 +02:00
Mariano Scazzariello a18f91bf08
Fix long line
Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
2023-05-07 11:49:59 +02:00
Mariano Scazzariello a662d5a305
Fix pytests
Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
2023-05-07 11:47:07 +02:00
Mariano Scazzariello 1d697680d2
Full support to networking config during container creation
Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
2023-05-07 11:46:58 +02:00
John Yang 576e47aaac
api: update return type of `diff` method (#3115)
Signed-off-by: John Yang <john.yang20@berkeley.edu>
2023-05-05 16:21:46 -04:00
Felix Fontein 3178c8d48b
deps: compatiblity with requests ≥ 2.29.0 and urllib3 2.x (#3116)
Requirements are the same, so it's still possible to use `urllib3 < 2`
or `requests == 2.28.2` for example.

Signed-off-by: Felix Fontein <felix@fontein.de>
2023-05-05 11:39:31 -04:00
I-question-this a02ba74333
socket: use poll() instead of select() except on Windows (#2865)
Fixes #2278, which was originally addressed in #2279, but was not
properly merged. Additionally it did not address the problem
of poll not existing on Windows. This patch falls back on the
more limited select method if host system is Windows.

Signed-off-by: Tyler Westland <tylerofthewest@gmail.com>
2023-04-21 17:53:58 -04:00
Aarni Koskela aaf68b7f98
api: note the data arg may also be a stream in `put_archive` (#2478)
Signed-off-by: Aarni Koskela <akx@iki.fi>
2023-02-22 14:05:19 -05:00
Milas Bowman f84623225e
socket: fix for errors on pipe close in Windows (#3099)
Need to return data, not size. By returning an empty
string, EOF will be detected properly since `len()`
will be `0`.

Fixes #3098.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-02-22 12:00:47 -05:00
Lorin Bucher 7cd7458f2f
api: add `status` parameter to services list (#3093)
Signed-off-by: Lorin Bucher <lorin@lbtec.dev>
2023-02-16 10:38:52 -05:00
Andy Roxby e9d4ddfaec
api: add `one-shot` option to container `stats` (#3089)
Signed-off-by: Andy Roxby <107427605+aroxby-wayscript@users.noreply.github.com>
2023-02-16 10:27:45 -05:00
Milas Bowman aca129dd69 Merge branch 'master'
(Old PR unintentionally went to the `master` branch.)
2023-01-27 09:27:42 -05:00
Mariano Scazzariello ee9151f336
client: add `network_driver_opt` to container run and create (#3083)
Signed-off-by: Mariano Scazzariello <marianoscazzariello@gmail.com>
2023-01-27 09:26:21 -05:00
Peter Wu 34e6829dd4
exec: fix file handle leak with container.exec_* APIs (#2320)
Requests with stream=True MUST be closed or else the connection will
never be returned to the connection pool. Both ContainerApiMixin.attach
and ExecApiMixin.exec_start were leaking in the stream=False case.
exec_start was modified to follow attach for the stream=True case as
that allows the caller to close the stream when done (untested).

Tested with:

    # Test exec_run (stream=False) - observe one less leak
    make integration-test-py3 file=models_containers_test.py' -k test_exec_run_success -vs -W error::ResourceWarning'
    # Test exec_start (stream=True, fully reads from CancellableStream)
    make integration-test-py3 file=api_exec_test.py' -k test_execute_command -vs -W error::ResourceWarning'

After this change, one resource leak is removed, the remaining resource
leaks occur because none of the tests call client.close().

Fixes https://github.com/docker/docker-py/issues/1293
(Regression from https://github.com/docker/docker-py/pull/1130)

Signed-off-by: Peter Wu <pwu@cloudflare.com>
Co-authored-by: Milas Bowman <milas.bowman@docker.com>
2023-01-13 15:41:01 -05:00
Yanlong Wang 22718ba59a
fix(store): warn on init instead of throw (#3080)
Signed-off-by: yanlong.wang <yanlong.wang@naiver.org>
2023-01-10 17:45:25 -05:00
dependabot[bot] d38b41a13c
build(deps): Bump setuptools from 63.2.0 to 65.5.1 (#3082)
Bumps [setuptools](https://github.com/pypa/setuptools) from 63.2.0 to 65.5.1.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/CHANGES.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v63.2.0...v65.5.1)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 17:25:12 -05:00
Maxim Mironyuk 3afb4b61c3
docs: fix wrong command syntax in code annotation (#3081)
Signed-off-by: Maxim Mironyuk <serieznyi@gmail.com>
2023-01-10 16:58:51 -05:00
loicleyendecker 82cf559b5a
volume: do not strip trailing characters from names (#3073)
Only remove `:ro` or `:rw` suffixes in their entirety; do not
strip arbitrary `r` / `o` / `w` / `:` characters individually.

Signed-off-by: Loïc Leyendecker <loic.leyendecker@gmail.com>
2022-12-02 14:48:04 -05:00
Hugo van Kemenade 8590eaad3c
ci: add support for Python 3.11 (#3064)
Signed-off-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2022-11-15 08:10:56 -05:00
Nick Santos 30022984f6
socket: handle npipe close on Windows (#3056)
Fixes https://github.com/docker/docker-py/issues/3045

Signed-off-by: Nick Santos <nick.santos@docker.com>
2022-11-02 15:31:00 -04:00
Brian Goff bc0a5fbacd
test: use anonymous volume for prune (#3051)
This is related to https://github.com/moby/moby/pull/44216

Prunes will, by default, no longer prune named volumes, only anonymous ones.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2022-10-05 13:54:45 -04:00
Rhiza 923e067ddd
api: add support for floats to docker logs params since / until (#3031)
Add support for floats to docker logs params `since` / `until` since the
Docker Engine APIs support it.

This allows using fractional seconds for greater precision.

Signed-off-by: Archi Moebius <poerhiz@gmail.com>
2022-08-19 15:10:53 -04:00
Sebastiaan van Stijn 1c27ec1f0c
ci: use latest stable syntax for Dockerfiles (#3035)
I noticed one Dockerfile was pinned to 1.4; given that there's a
backward compatibility guarantee on the stable syntax, the general
recommendation is to use `dockerfile:1`, which makes sure that the
latest stable release of the Dockerfile syntax is pulled before
building.

While changing, I also made some minor changes to some Dockerfiles
to reduce some unneeded layers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-19 15:09:12 -04:00
Milas Bowman 2494d63f36
docs: install package in ReadTheDocs build (#3032)
Need to install ourselves so that we can introspect on version
using `setuptools_scm` in `docs/conf.py`.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-08-18 17:03:32 -04:00
Milas Bowman e901eac7a8
test: add additional tests for cgroupns option (#3024)
See #2930.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-08-12 14:27:53 -04:00
Chris Hand fc86ab0d85
swarm: add support for DataPathPort on init (#2987)
Adds support for setting the UDP port used for VXLAN traffic between
swarm nodes

Signed-off-by: Chris Hand <dexteradeus@users.noreply.github.com>
2022-08-12 09:58:57 -04:00
Milas Bowman 45bf9f9115 Merge remote-tracking branch 'upstream/main' into patch-1 2022-08-12 09:43:20 -04:00
Milas Bowman c03aeb659e Merge remote-tracking branch 'upstream/main' into connect-with-mac 2022-08-12 09:21:51 -04:00
Quentin Mathorel 58aa62bb15
swarm: add sysctl support for services (#3029)
Signed-off-by: Quentin Mathorel <quentin.mathorel@outlook.fr>
2022-08-12 08:55:19 -04:00
Milas Bowman ff0b4ac60b
docs: add changelog for 6.0.0 (#3019)
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-08-11 17:20:13 -04:00
Leonard Kinday 66402435d1
Support `global-job` and `replicated-job` modes in Docker Swarm (#3016)
Add `global-job` and `replicated-job` modes

Fixes #2829.

Signed-off-by: Leonard Kinday <leonard@kinday.ru>
2022-08-11 16:20:31 -04:00
Ningú 42789818be
credentials: eliminate distutils deprecation warnings (#3028)
While removing any usage of the deprecated `distutils` package,
("The distutils package is deprecated and slated for removal in Python 3.12.")
this internal utility can be removed straightaway because the
`shutil.which` replacement for `distutils.spawn.find_executable`
already honors the `PATHEXT` environment variable in windows systems.

See https://docs.python.org/3/library/shutil.html#shutil.which

Signed-off-by: Daniel Möller <n1ngu@riseup.net>
2022-08-02 10:19:50 -04:00
q0w ab5e927300
lint: remove extraneous logic for `preexec_func` (#2920)
`preexec_func` is still None if it is win32

Signed-off-by: q0w <43147888+q0w@users.noreply.github.com>
2022-08-02 10:11:07 -04:00
Saurav Maheshkar b7daa52feb
docs: add `gzip` arg to `BuildApiMixin` (#2929)
Signed-off-by: Saurav Maheshkar <sauravvmaheshkar@gmail.com>
2022-08-02 10:08:24 -04:00
Thomas Gassmann 3f0095a7c1
docs: remove duplicate 'on' in comment (#2370)
Remove duplicate 'on' in comment

Signed-off-by: Thomas Gassmann <thomas.gassmann@hotmail.com>
2022-07-30 12:43:29 -04:00
Milas Bowman 631b332cd9
ci: add missing wheel package
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-30 12:23:53 -04:00
Milas Bowman 7f1bde162f
ci: fix quoting in YAML
Because apparently `!` is special

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-30 12:20:50 -04:00
Milas Bowman cd2c35a9b6
ci: add workflow for releases (#3018)
GitHub Actions workflow to create a release: will upload to PyPI
and create a GitHub release with the `sdist` and `bdist_wheel`
as well.

The version code is switched to `setuptools_scm` to work well
with this flow (e.g. avoid needing to write a script that does
a `sed` on the version file and commits as part of release).

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-30 12:14:27 -04:00
Milas Bowman 828d06f5f5
docs: fix RollbackConfig/Order values (#3027)
Closes #2626.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-30 12:09:36 -04:00
Max Fan dff849f6bb
docs: image build clarifications/grammar (#2489)
I changed was build > was built and reorganized a few sentences to be more clear.

Signed-off-by: InnovativeInventor <theinnovativeinventor@gmail.com>
2022-07-29 16:15:58 -04:00
Hristo Georgiev 52fb27690c
docs: fix image save example (#2570)
Signed-off-by: Hristo Georgiev <hristo.a.georgiev@gmail.com>
2022-07-29 16:04:23 -04:00
Milas Bowman 547cc5794d Merge branch 'docs-healthcheck'
Manually merging #2595 to include a tiny fix.
2022-07-29 16:02:47 -04:00
Milas Bowman 003a16503a docs: fix list formatting
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-29 16:01:29 -04:00
Milas Bowman c6c2bbdcda Merge remote-tracking branch 'upstream/main' into HEAD 2022-07-29 15:56:01 -04:00
Ville Skyttä 73421027be
docs: clarify TLSConfig verify parameter (#2573)
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2022-07-29 15:55:14 -04:00
Ville Skyttä 55f47299c4
docs: fix TLS server verify example (#2574)
Leaving out the verify parameter means verification will not be done.

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2022-07-29 15:54:27 -04:00
Clément Loiselet 3ee3a2486f
build: trim trailing whitespace from dockerignore entries (#2733)
fix(dockerignore): trim trailing whitespace

Signed-off-by: Clément Loiselet <clement.loiselet@capgemini.com>
2022-07-29 15:33:23 -04:00
Milas Bowman 868e996269
model: add remove() to Image (#3026)
Allow an Image to be deleted by calling the remove() method on it,
just like a Volume.

Signed-off-by: Ahmon Dancy <dancy@dancysoft.com>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Co-authored-by: Ahmon Dancy <dancy@dancysoft.com>
2022-07-29 15:28:16 -04:00
ercildoune 26753c81de
api: add rollback_config to service create (#2917)
`rollback_config` was not in the list of `CREATE_SERVICE_KWARGS`
which prevented it from being an argument when creating services.
It has now been added and the problem fixed, allowing services to
have a rollback_config during creation and updating.

Fixes #2832.

Signed-off-by: Fraser Patten <pattenf00@gmail.com>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Co-authored-by: Milas Bowman <milas.bowman@docker.com>
2022-07-29 14:54:55 -04:00