dnephin: some CI failures, otherwise looks good
diff --git a/docker/auth/auth.py b/docker/auth/auth.py
index 366bc67e..1ee9f812 100644
--- a/docker/auth/auth.py
+++ b/docker/auth/auth.py
@@ -102,7 +102,7 @@ def decode_auth(auth):
 
 def encode_header(auth):
     auth_json = json.dumps(auth).encode('ascii')
-    return base64.b64encode(auth_json)
+    return base64.urlsafe_b64encode(auth_json)
 
 
 def parse_auth(entries):

Auth fails with long passwords
See https://github.com/docker/docker/issues/16840

docker-py is encoding `X-Registry-Auth` with regular base64 and not the url safe version of base64 that jwt tokens use.
diff --git a/tests/utils_test.py b/tests/utils_test.py
index b1adde26..04183f9f 100644
--- a/tests/utils_test.py
+++ b/tests/utils_test.py
@@ -19,7 +19,9 @@ from docker.utils import (
     exclude_paths, convert_volume_binds, decode_json_header
 )
 from docker.utils.ports import build_port_bindings, split_port
-from docker.auth import resolve_repository_name, resolve_authconfig
+from docker.auth import (
+    resolve_repository_name, resolve_authconfig, encode_header
+)
 
 from . import base
 from .helpers import make_tree
@@ -376,12 +378,21 @@ class UtilsTest(base.BaseTestCase):
         obj = {'a': 'b', 'c': 1}
         data = None
         if six.PY3:
-            data = base64.b64encode(bytes(json.dumps(obj), 'utf-8'))
+            data = base64.urlsafe_b64encode(bytes(json.dumps(obj), 'utf-8'))
         else:
-            data = base64.b64encode(json.dumps(obj))
+            data = base64.urlsafe_b64encode(json.dumps(obj))
         decoded_data = decode_json_header(data)
         self.assertEqual(obj, decoded_data)
 
+    def test_803_urlsafe_encode(self):
+        auth_data = {
+            'username': 'root',
+            'password': 'GR?XGR?XGR?XGR?X'
+        }
+        encoded = encode_header(auth_data)
+        assert b'/' not in encoded
+        assert b'_' in encoded
+
     def test_resolve_repository_name(self):
         # docker hub library image
         self.assertEqual(

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest
apt-get update apt-get install -y gcc
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi @ file:///croot/certifi_1671487769961/work/certifi
coverage==7.2.7
-e git+https://github.com/docker/docker-py.git@f479720d517a7db7f886916190b3032d29d18f10#egg=docker_py
exceptiongroup==1.2.2
importlib-metadata==6.7.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.2.0
pytest==7.4.4
pytest-cov==4.1.0
requests==2.5.3
six==1.17.0
tomli==2.0.1
typing_extensions==4.7.1
websocket-client==0.32.0
zipp==3.15.0

name: docker-py
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - coverage==7.2.7
      - exceptiongroup==1.2.2
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - packaging==24.0
      - pluggy==1.2.0
      - pytest==7.4.4
      - pytest-cov==4.1.0
      - requests==2.5.3
      - six==1.17.0
      - tomli==2.0.1
      - typing-extensions==4.7.1
      - websocket-client==0.32.0
      - zipp==3.15.0
prefix: /opt/conda/envs/docker-py

tests/utils_test.py::UtilsTest::test_803_urlsafe_encode
tests/utils_test.py::HostConfigTest::test_create_host_config_invalid_cpu_cfs_types tests/utils_test.py::HostConfigTest::test_create_host_config_no_options tests/utils_test.py::HostConfigTest::test_create_host_config_no_options_newer_api_version tests/utils_test.py::HostConfigTest::test_create_host_config_with_cpu_period tests/utils_test.py::HostConfigTest::test_create_host_config_with_cpu_quota tests/utils_test.py::UlimitTest::test_create_host_config_dict_ulimit tests/utils_test.py::UlimitTest::test_create_host_config_dict_ulimit_capitals tests/utils_test.py::UlimitTest::test_create_host_config_obj_ulimit tests/utils_test.py::UlimitTest::test_ulimit_invalid_type tests/utils_test.py::LogConfigTest::test_create_host_config_dict_logconfig tests/utils_test.py::LogConfigTest::test_create_host_config_obj_logconfig tests/utils_test.py::LogConfigTest::test_logconfig_invalid_config_type tests/utils_test.py::KwargsFromEnvTest::test_kwargs_from_env_empty tests/utils_test.py::KwargsFromEnvTest::test_kwargs_from_env_no_cert_path tests/utils_test.py::KwargsFromEnvTest::test_kwargs_from_env_tls tests/utils_test.py::UtilsTest::test_convert_filters tests/utils_test.py::UtilsTest::test_convert_volume_binds_compact tests/utils_test.py::UtilsTest::test_convert_volume_binds_complete tests/utils_test.py::UtilsTest::test_convert_volume_binds_empty tests/utils_test.py::UtilsTest::test_convert_volume_binds_list tests/utils_test.py::UtilsTest::test_convert_volume_binds_no_mode tests/utils_test.py::UtilsTest::test_convert_volume_binds_unicode_bytes_input tests/utils_test.py::UtilsTest::test_convert_volume_binds_unicode_unicode_input tests/utils_test.py::UtilsTest::test_decode_json_header tests/utils_test.py::UtilsTest::test_parse_bytes tests/utils_test.py::UtilsTest::test_parse_env_file_commented_line tests/utils_test.py::UtilsTest::test_parse_env_file_invalid_line tests/utils_test.py::UtilsTest::test_parse_env_file_proper tests/utils_test.py::UtilsTest::test_parse_host tests/utils_test.py::UtilsTest::test_parse_host_empty_value tests/utils_test.py::UtilsTest::test_parse_repository_tag tests/utils_test.py::UtilsTest::test_resolve_authconfig tests/utils_test.py::UtilsTest::test_resolve_registry_and_auth tests/utils_test.py::UtilsTest::test_resolve_repository_name tests/utils_test.py::PortsTest::test_build_port_bindings_with_matching_internal_port_ranges tests/utils_test.py::PortsTest::test_build_port_bindings_with_matching_internal_ports tests/utils_test.py::PortsTest::test_build_port_bindings_with_nonmatching_internal_port_ranges tests/utils_test.py::PortsTest::test_build_port_bindings_with_nonmatching_internal_ports tests/utils_test.py::PortsTest::test_build_port_bindings_with_one_port tests/utils_test.py::PortsTest::test_build_port_bindings_with_port_range tests/utils_test.py::PortsTest::test_host_only_with_colon tests/utils_test.py::PortsTest::test_non_matching_length_port_ranges tests/utils_test.py::PortsTest::test_port_and_range_invalid tests/utils_test.py::PortsTest::test_port_only_with_colon tests/utils_test.py::PortsTest::test_split_port_invalid tests/utils_test.py::PortsTest::test_split_port_no_host_port tests/utils_test.py::PortsTest::test_split_port_range_no_host_port tests/utils_test.py::PortsTest::test_split_port_range_with_host_ip_no_port tests/utils_test.py::PortsTest::test_split_port_range_with_host_port tests/utils_test.py::PortsTest::test_split_port_range_with_protocol tests/utils_test.py::PortsTest::test_split_port_with_host_ip tests/utils_test.py::PortsTest::test_split_port_with_host_ip_no_port tests/utils_test.py::PortsTest::test_split_port_with_host_port tests/utils_test.py::PortsTest::test_split_port_with_protocol tests/utils_test.py::ExcludePathsTest::test_directory tests/utils_test.py::ExcludePathsTest::test_directory_with_single_exception tests/utils_test.py::ExcludePathsTest::test_directory_with_subdir_exception tests/utils_test.py::ExcludePathsTest::test_directory_with_trailing_slash tests/utils_test.py::ExcludePathsTest::test_directory_with_wildcard_exception tests/utils_test.py::ExcludePathsTest::test_exclude_custom_dockerfile tests/utils_test.py::ExcludePathsTest::test_exclude_dockerfile_dockerignore tests/utils_test.py::ExcludePathsTest::test_no_dupes tests/utils_test.py::ExcludePathsTest::test_no_excludes tests/utils_test.py::ExcludePathsTest::test_question_mark tests/utils_test.py::ExcludePathsTest::test_single_filename tests/utils_test.py::ExcludePathsTest::test_single_filename_trailing_slash tests/utils_test.py::ExcludePathsTest::test_single_subdir_single_filename tests/utils_test.py::ExcludePathsTest::test_single_subdir_wildcard_filename tests/utils_test.py::ExcludePathsTest::test_subdirectory tests/utils_test.py::ExcludePathsTest::test_wildcard_exclude tests/utils_test.py::ExcludePathsTest::test_wildcard_filename_end tests/utils_test.py::ExcludePathsTest::test_wildcard_filename_start tests/utils_test.py::ExcludePathsTest::test_wildcard_subdir_single_filename tests/utils_test.py::ExcludePathsTest::test_wildcard_subdir_wildcard_filename tests/utils_test.py::ExcludePathsTest::test_wildcard_with_exception tests/utils_test.py::ExcludePathsTest::test_wildcard_with_wildcard_exception
docker/auth/auth.py
docker/auth/auth.py