Commit Graph

3307 Commits

Author SHA1 Message Date
Till! 0031ac2186
api: add force to plugin disable (#2843)
Signed-off-by: till <till@php.net>
2022-07-29 14:51:43 -04:00
Peter Dave Hello b2a18d7209
build: disable pip cache in Dockerfile (#2828)
Signed-off-by: Peter Dave Hello <hsu@peterdavehello.org>
2022-07-29 14:09:06 -04:00
David d69de54d7c
api: add cgroupns option to container create (#2930)
Signed-off-by: David Otto <ottodavid@gmx.net>
2022-07-29 14:04:47 -04:00
Felix Fontein 1a4cacdfb6
api: add platform to container create (#2927)
Add platform parameter for container creation/run

Signed-off-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Co-authored-by: Milas Bowman <milas.bowman@docker.com>
2022-07-29 13:57:30 -04:00
Milas Bowman 26064dd6b5
deps: upgrade websocket-client to latest (#3022)
* Upgrade websocket-client to latest
* Add basic integration test for streaming logs via websocket

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-29 11:09:47 -04:00
Milas Bowman 05e143429e
api: preserve cause when re-raising error (#3023)
Use `from e` to ensure that the error context is propagated
correctly.

Fixes #2702.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-29 11:08:00 -04:00
Ben Fasoli 23cf16f03a
client: use 12 character short IDs (#2862)
Use 12 characters for Docker resource IDs for
consistency with the Docker CLI.

Signed-off-by: Ben Fasoli <benfasoli@gmail.com>
2022-07-29 09:06:22 -04:00
Milas Bowman ab43018b02
docs: fix markdown rendering (#3020)
Follow instructions at https://www.sphinx-doc.org/en/master/usage/markdown.html.

This switches from `recommonmark` (deprecated) to `myst-parser`
(recommended).

Only impacts the changelog page, which was broken after recent upgrades
to Sphinx for Python 3.10 compatibility.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-28 16:38:57 -04:00
Milas Bowman 9bdb5ba2ba
lint: fix line length violation (#3017)
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-28 11:25:17 -04:00
Milas Bowman be942f8390
deps: upgrade & remove unnecessary dependencies (#3014)
The `requirements.txt` and `setup.py` had a lot of extra transitive
dependencies to try and address various SSL shortcomings from the
Python ecosystem.

Thankfully, between modern Python versions (3.6+) and corresponding
`requests` versions (2.26+), this is all unnecessary now!

As a result, a bunch of transitive dependencies have been removed
from `requirements.txt`, the minimum version of `requests` increased,
and the `tls` extra made into a no-op.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-28 08:32:00 -04:00
Milas Bowman bf026265e0
ci: bump version to 6.0.0-dev (#3013)
It's been a long time without a release, and we've included a
number of fixes as well as raised the minimum Python version,
so a major release seems in order.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-28 08:31:45 -04:00
Tim Gates d2d097efbb
docs: fix simple typo, containe -> container (#3015)
There is a small typo in docker/types/services.py.

Should read `container` rather than `containe`.

Signed-off-by: Tim Gates <tim.gates@iress.com>
2022-07-28 08:30:40 -04:00
Milas Bowman acdafbc116
ci: run SSH integration tests (#3012)
Fix & enable SSH integration test suite.

This also adds a new test for connecting to unknown hosts when
using the Python SSH implementation (Paramiko). See #2932 for
more info.

Because of the above, some of the config/static key files have been
moved around and adjusted.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-27 16:25:27 -04:00
Vilhelm Prytz ea4cefe4fd
lint: remove unnecessary pass statements (#2541)
Signed-off-by: Vilhelm Prytz <vilhelm@prytznet.se>
2022-07-27 15:31:04 -04:00
Karthikeyan Singaravelan adf5a97b12
lint: fix deprecation warnings from threading package (#2823)
Set `daemon` attribute instead of using `setDaemon` method that
was deprecated in Python 3.10.

Signed-off-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
2022-07-27 15:25:11 -04:00
Audun V. Nes d9298647d9
ssh: reject unknown host keys when using Python SSH impl (#2932)
In the Secure Shell (SSH) protocol, host keys are used to verify the identity of remote hosts. Accepting unknown host keys may leave the connection open to man-in-the-middle attacks.

Do not accept unknown host keys. In particular, do not set the default missing host key policy for the Paramiko library to either AutoAddPolicy or WarningPolicy. Both of these policies continue even when the host key is unknown. The default setting of RejectPolicy is secure because it throws an exception when it encounters an unknown host key.

Reference: https://cwe.mitre.org/data/definitions/295.html

NOTE: This only affects SSH connections using the native Python SSH implementation (Paramiko), when `use_ssh_client=False` (default). If using the system SSH client (`use_ssh_client=True`), the host configuration
(e.g. `~/.ssh/config`) will apply.

Signed-off-by: Audun Nes <audun.nes@gmail.com>
2022-07-27 15:01:41 -04:00
errorcode bb40ba051f
ssh: do not create unnecessary subshell on exec (#2910)
Signed-off-by: liubo <liubo@uniontech.com>
2022-07-27 14:57:26 -04:00
Milas Bowman 52e29bd446
deps: remove backports.ssl_match_hostname (#3011)
This is no longer needed as it exists in every supported (non-EOL)
version of Python that we target.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-27 14:44:50 -04:00
Milas Bowman da62a28837
deps: test on Python 3.10 by default (#3010)
* Upgrade to latest Sphinx / recommonmark
* Small CSS fix for issue in new version of Alabaster theme
* Fix `Makefile` target for macOS

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-27 14:44:36 -04:00
Leonard Kinday 0ee9f260e4
ci: run integration tests & fix race condition (#2947)
* Fix integration tests race condition
* Run integration tests on CI
* Use existing DIND version

Signed-off-by: Leonard Kinday <leonard@kinday.ru>

Co-authored-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 16:33:21 -04:00
Milas Bowman b9ca58a56d
Merge pull request #3009 from milas/lint-flake8
ci: add flake8 job
2022-07-26 15:48:55 -04:00
Milas Bowman cf6210316f
Merge pull request #3008 from milas/flaky-tests
test: fix a couple flaky/broken tests
2022-07-26 15:48:35 -04:00
Francesco Casalegno 2e6dad7983
deps: use `packaging` instead of deprecated `distutils` (#2931)
Replace `distutils.Version` (deprecated) with `packaging.Version`

Signed-off-by: Francesco Casalegno <francesco.casalegno@gmail.com>
2022-07-26 15:45:51 -04:00
Guy Lichtman 4e19cc48df
transport: fix ProxyCommand for SSH conn (#2993)
Signed-off-by: Guy Lichtman <glicht@users.noreply.github.com>
2022-07-26 15:16:12 -04:00
Milas Bowman 56dd6de7df
tls: use auto-negotiated highest version (#3007)
Specific TLS versions are deprecated in latest Python, which
causes test failures due to treating deprecation errors as
warnings.

Luckily, the fix here is straightforward: we can eliminate some
custom version selection logic by using `PROTOCOL_TLS_CLIENT`,
which is the recommended method and will select the highest TLS
version supported by both client and server.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 15:12:03 -04:00
Maor Kleinberger bb11197ee3
client: fix exception semantics in _raise_for_status (#2954)
We want "The above exception was the direct cause of the following exception:" instead of "During handling of the above exception, another exception occurred:"

Signed-off-by: Maor Kleinberger <kmaork@gmail.com>
2022-07-26 15:07:23 -04:00
Milas Bowman 3ffdd8a1c5 lint: fix outstanding flake8 violations
Since flake8 wasn't actually being run in CI, we'd accumulated some
violations.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 13:48:47 -04:00
Milas Bowman ce40d4bb34 ci: add flake8 job
Project is already configured for flake8 but it never gets run in
CI.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 13:48:10 -04:00
Milas Bowman 4765f62441 test: mark invalid test as xfail
This test looks for some behavior on non-chunked HTTP requests.

It now fails because it looks like recent versions of Docker Engine
ALWAYS return chunked responses (or perhaps this specific response
changed somehow to now trigger chunking whereas it did not previously).

The actual logic it's trying to test is also unusual because it's
trying to hackily propagate errors under the assumption that it'd get
a non-chunked response on failure, which is...not reliable. Arguably,
the chunked reader should be refactored somehow but that's a refactor
we can't really commit to (and it's evidently been ok enough as is
up until now).

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 13:00:49 -04:00
Milas Bowman 74e0c5eb8c test: fix flaky container log test
Ensure the container has exited before attempting to grab the logs.

Since we are not streaming them, it's possible to attach + grab logs
before the output is processed, resulting in a test failure. If the
container has exited, it's guaranteed to have logged :)

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 13:00:49 -04:00
Sebastiaan van Stijn 7168e09b16
test: fix for cgroupv2 (#2940)
This test was verifying that the container has the right options set (through
`docker inspect`), but also checks if the cgroup-rules are set within the
container by reading `/sys/fs/cgroup/devices/devices.list`

Unlike cgroups v1, on cgroups v2, there is no file interface, and rules are
handled through ebpf, which means that the test will fail because this file
is not present.

From the Linux documentation for cgroups v2:
https://github.com/torvalds/linux/blob/v5.16/Documentation/admin-guide/cgroup-v2.rst#device-controller

> (...)
> Device controller manages access to device files. It includes both creation of
> new device files (using mknod), and access to the existing device files.
>
> Cgroup v2 device controller has no interface files and is implemented on top
> of cgroup BPF. To control access to device files, a user may create bpf programs
> of type BPF_PROG_TYPE_CGROUP_DEVICE and attach them to cgroups with
> BPF_CGROUP_DEVICE flag. (...)

Given that setting the right cgroups is not really a responsibility of this SDK,
it should be sufficient to verify that the right options were set in the container
configuration, so this patch is removing the part that checks the cgroup, to
allow this test to be run on a host with cgroups v2 enabled.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-26 12:06:51 -04:00
Milas Bowman f16c4e1147
utils: fix IPv6 address w/ port parsing (#3006)
This was using a deprecated function (`urllib.splitnport`),
ostensibly to work around issues with brackets on IPv6 addresses.

Ironically, its usage was broken, and would result in mangled IPv6
addresses if they had a port specified in some instances.

Usage of the deprecated function has been eliminated and extra test
cases added where missing. All existing cases pass as-is. (The only
other change to the test was to improve assertion messages.)

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 11:35:44 -04:00
Milas Bowman 2933af2ca7
ci: remove Python 3.6 and add 3.11 pre-releases (#3005)
* Python 3.6 went EOL Dec 2021
* Python 3.11 is in beta and due for GA release in October 2022

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 08:51:52 -04:00
Milas Bowman a6db044bd4
deps: upgrade pywin32 & relax version constraint (#3004)
Upgrade to latest pywin32, which has support for Python 3.10 and
resolves a CVE (related to ACL APIs, outside the scope of what
`docker-py` relies on, which is npipe support, but still gets
flagged by scanners).

The version constraint has also been relaxed in `setup.py` to allow
newer versions of pywin32. This is similar to how we handle the
other packages there, and should be safe from a compatibility
perspective.

Fixes #2902.
Closes #2972 and closes #2980.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 08:43:45 -04:00
Laura Brehm e131955685
Merge pull request #2974 from docker/dependabot/pip/paramiko-2.10.1
Bump paramiko from 2.8.0 to 2.10.1
2022-07-13 12:50:12 +02:00
dependabot[bot] e0a3abfc37
Bump paramiko from 2.8.0 to 2.10.1
Bumps [paramiko](https://github.com/paramiko/paramiko) from 2.8.0 to 2.10.1.
- [Release notes](https://github.com/paramiko/paramiko/releases)
- [Changelog](https://github.com/paramiko/paramiko/blob/main/NEWS)
- [Commits](https://github.com/paramiko/paramiko/compare/2.8.0...2.10.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-29 21:55:39 +00:00
Stefan Scherer a48a5a9647
Merge pull request #2898 from hugovk/add-3.10
Add support for Python 3.10
2021-10-14 19:25:22 +02:00
Stefan Scherer ac5f6ef93a
Merge pull request #2897 from aiordache/changelog_5.0.3
Update changelog for 5.0.3
2021-10-14 10:46:17 +02:00
Hugo van Kemenade 4bb99311e2 Don't install mock backport
Signed-off-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2021-10-11 23:06:12 +03:00
Hugo van Kemenade bbbc29191a Bump minimum paramiko to support Python 3.10
Signed-off-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2021-10-11 23:06:12 +03:00
Hugo van Kemenade 72bcd1616d Bump pytest (and other dependencies) for Python 3.10
Signed-off-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2021-10-11 23:06:12 +03:00
Hugo van Kemenade 4150fc4d9d Universal wheels are for code expected to work on both Python 2 and 3
Signed-off-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2021-10-11 23:06:12 +03:00
Hugo van Kemenade a9de343210 Add support for Python 3.10
Signed-off-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2021-10-11 23:06:12 +03:00
Anca Iordache ecace769f5 Post-release changelog update
Signed-off-by: Anca Iordache <anca.iordache@docker.com>
2021-10-08 00:58:26 +02:00
Anca Iordache 7172269b06
Merge pull request #2806 from feliperuhland/fix-low-level-volumes-example
Fix volumes low-level documentation examples
2021-10-08 00:05:55 +02:00
Anca Iordache fcb35f4197
Merge pull request #2810 from feliperuhland/fix-low-level-swarm-example
Fix swarm low-level documentation examples
2021-10-08 00:04:02 +02:00
Anca Iordache 3c5f0d0ee1
Merge pull request #2805 from feliperuhland/fix-low-level-network-example
Fix network low-level documentation examples
2021-10-08 00:03:11 +02:00
Anca Iordache 7779b84e87
Merge pull request #2809 from feliperuhland/add-service-capability
Add service capability
2021-10-08 00:01:28 +02:00
Anca Iordache df59f538c2
Merge pull request #2852 from Phat3/feat/add_templating_parameter_docker_config
Add the possibility to set a templating driver when creating a new Docker config
2021-10-07 23:59:08 +02:00
Anca Iordache aae6be0c58
Merge branch 'master' into feat/add_templating_parameter_docker_config 2021-10-07 23:29:03 +02:00