Update the regex and add test cases.
(There are some xfails here for cases that the regex is not currently
handling. It's too strict for IPv6 domains at the moment.)
Closes: https://github.com/docker/docker-py/issues/3195
Related: https://github.com/opencontainers/distribution-spec/pull/498
Signed-off-by: Sven Kieske <kieske@osism.tech>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Co-authored-by: Milas Bowman <milas.bowman@docker.com>
Container related Image fields (`Container` and `ContainerConfig`) will
be deprecated in API v1.44 and will be removed in v1.45.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Add support for Python 3.12.
`match_hostname` is gone in Python 3.12 and has been unused by
Python since 3.7.
The custom SSL adapter allows passing a specific SSL version; this
was first introduced a looong time ago to handle some SSL issues
at the time.
Closes#3176.
---------
Signed-off-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
integration: check_duplicate is now the default behavior
moby/moby#46251 marks CheckDuplicate as deprecated. Any NetworkCreate
request with a conflicting network name will now return an error.
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
Some network integration tests are creating networks with subnet
`2001:389::1/64`. This is an invalid subnet as the host fragment is
non-zero (ie. it should be `2001:389::/64`).
PR moby/moby#45759 is adding strict validation of network configuration.
Docker API will now return an error whenever a bad subnet is passed.
Signed-off-by: Albin Kerouanton <albinker@gmail.com>
The official Python images on Docker Hub switched to debian bookworm,
which is now the current stable version of Debian.
However, the location of the apt repository config file changed, which
causes the Dockerfile build to fail;
Loaded image: emptyfs:latest
Loaded image ID: sha256:0df1207206e5288f4a989a2f13d1f5b3c4e70467702c1d5d21dfc9f002b7bd43
INFO: Building docker-sdk-python3:5.0.3...
tests/Dockerfile:6
--------------------
5 | ARG APT_MIRROR
6 | >>> RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list \
7 | >>> && sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list
8 |
--------------------
ERROR: failed to solve: process "/bin/sh -c sed -ri \"s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g\" /etc/apt/sources.list && sed -ri \"s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g\" /etc/apt/sources.list" did not complete successfully: exit code: 2
The APT_MIRROR build-arg was originally added when the Debian package
repositories were known to be unreliable, but that hasn't been the
case for quite a while, so let's remove this altogether.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Co-authored-by: Milas Bowman <milas.bowman@docker.com>
I was in the process of cleaning up some error-messages, and it looks like
the docker-py tests were depending on strings that will be removed;
=================================== FAILURES ===================================
_____________ CreateContainerTest.test_create_with_restart_policy ______________
tests/integration/api_container_test.py:126: in test_create_with_restart_policy
assert 'You cannot remove ' in err
E AssertionError: assert 'You cannot remove ' in 'cannot remove container d11580f6078108691096ec8a23404a6bda9ad1d1b2bafe88b17d127a67728833: container is restarting: stop the container before removing or force remove'
____________________ ErrorsTest.test_api_error_parses_json _____________________
tests/integration/errors_test.py:13: in test_api_error_parses_json
assert 'You cannot remove a running container' in explanation
E AssertionError: assert 'You cannot remove a running container' in 'cannot remove container 4b90ce2e907dd0f99d0f561619b803e7a2a31809ced366c537874dd13f8a47ec: container is running: stop the container before removing or force remove'
This updates the tests to match on a string that will be present in both the
old and new error-messages, but added a "lower()", so that matching will be
done case-insensitive (Go errors generally should be lowercase).
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The Dockerfile failed to build due to the base-image having switched to "bookworm";
Dockerfile:8
--------------------
7 | ARG APT_MIRROR
8 | >>> RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list \
9 | >>> && sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list
10 |
--------------------
ERROR: failed to solve: process "/bin/sh -c sed -ri \"s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g\" /etc/apt/sources.list && sed -ri \"s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g\" /etc/apt/sources.list" did not complete successfully: exit code: 2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Run flake8 docker/ tests/
flake8 docker/ tests/
shell: /usr/bin/bash -e {0}
env:
DOCKER_BUILDKIT: 1
pythonLocation: /opt/hostedtoolcache/Python/3.11.4/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.4/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.4/x64/lib
tests/integration/api_container_test.py:1395:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
tests/integration/api_container_test.py:1408:24: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
tests/integration/api_image_test.py:35:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
tests/integration/api_image_test.py:46:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
Error: Process completed with exit code 1.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
fix: api - container.stats infinite blocking on stream mode
Includes additional test for no streaming
Signed-off-by: Bharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com>
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>
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>
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>
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>
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>