{"library":"docker-pycreds","title":"docker-pycreds: Python bindings for the Docker credentials store API","description":"docker-pycreds provides Python bindings for the Docker credentials store API. It enables programmatic interaction with platform-specific credential helpers (e.g., `docker-credential-secretservice`) to securely store and retrieve Docker authentication tokens. The current version is 0.4.0, released on November 28, 2018. Due to its last update date, it has an infrequent release cadence and appears to be in maintenance mode.","status":"maintenance","version":"0.4.0","language":"en","source_language":"en","source_url":"https://github.com/shin-/dockerpy-creds","tags":["docker","credentials","security","authentication","keyring"],"install":[{"cmd":"pip install docker-pycreds","lang":"bash","label":"Install stable version from PyPI"}],"dependencies":[{"reason":"Compatibility layer for Python 2 and 3.","package":"six"},{"reason":"Requires a platform-specific Docker credential helper executable (e.g., docker-credential-secretservice for Linux, docker-credential-osxkeychain for macOS, or docker-credential-wincred for Windows) to be installed and available in the system's PATH. This is a crucial system-level dependency.","package":"docker-credential-helpers","optional":false}],"imports":[{"symbol":"Store","correct":"from dockerpycreds import Store"}],"quickstart":{"code":"import dockerpycreds\nimport os\n\n# Configure the credential store backend. Common options include:\n# 'secretservice' (Linux), 'osxkeychain' (macOS), 'wincred' (Windows)\n# If you have a custom credential helper, use its name (e.g., 'ecr-login')\n# Ensure the corresponding 'docker-credential-<backend>' executable is in your PATH.\nstore_backend = os.environ.get('DOCKER_CREDS_STORE_BACKEND', 'secretservice')\nstore = dockerpycreds.Store(store_backend)\n\n# Define credentials from environment variables for security in examples\nserver_url = os.environ.get('DOCKER_SERVER_URL', 'https://index.docker.io/v1/')\nusername = os.environ.get('DOCKER_USERNAME', 'testuser')\nsecret = os.environ.get('DOCKER_SECRET', 'testpassword')\n\nprint(f\"Attempting to store credentials for {username} on {server_url} using '{store_backend}'...\")\ntry:\n    store.store(\n        server=server_url,\n        username=username,\n        secret=secret\n    )\n    print(\"Credentials stored successfully. Note: This might have prompted for system keyring access.\")\nexcept Exception as e:\n    print(f\"Failed to store credentials: {e}. Ensure the credential helper is correctly configured and accessible.\")\n\nprint(\"\\nListing all known Docker credential servers:\")\ntry:\n    creds_list = store.list()\n    if creds_list:\n        for server, user in creds_list.items():\n            print(f\"  Server: {server}, Username: {user}\")\n    else:\n        print(\"  No credentials found.\")\nexcept Exception as e:\n    print(f\"Failed to list credentials: {e}. Listing may require user interaction or specific backend support.\")\n\n# Example of getting credentials (often requires explicit interaction with the helper)\n# This is commented out as it frequently requires external CLI calls or user prompts\n# which are hard to automate in a simple quickstart.\n# try:\n#     retrieved_username, retrieved_secret = store.get(server_url)\n#     print(f\"\\nRetrieved credentials for {server_url}: Username: {retrieved_username}, Secret: {'*' * len(retrieved_secret)}\")\n# except Exception as e:\n#     print(f\"Failed to retrieve credentials: {e}. This often requires direct Docker CLI interaction or specific credential helper setup.\")","lang":"python","description":"This quickstart demonstrates how to instantiate a credential store and use it to store and list Docker credentials. It assumes a `docker-credential` helper for your platform is installed and configured. Storing credentials might trigger a system-level prompt for keyring access depending on the backend."},"warnings":[{"fix":"Install the appropriate Docker credential helper for your operating system and ensure it's accessible in your system's PATH. Refer to Docker's official documentation on credential helpers.","message":"This library acts as a Python wrapper around external `docker-credential-<helper>` executables. It requires a suitable credential helper to be installed and available in your system's PATH (e.g., `docker-credential-secretservice` for Linux). Without these executables, the library cannot function.","severity":"gotcha","affected_versions":"0.1.0 - 0.4.0"},{"fix":"For core Docker interactions, rely on the `docker` SDK for Python which manages this dependency. If direct interaction is required, thoroughly test with your target Python and Docker environment. Be aware that issues might not be patched.","message":"The library has not been updated since November 2018 (version 0.4.0). While it's a dependency of the actively maintained `docker` (formerly `docker-py`) library, direct usage might encounter compatibility issues with newer Python versions (beyond 3.6) or recent changes in Docker's credential helper API.","severity":"deprecated","affected_versions":"<=0.4.0"},{"fix":"Ensure you `pip install docker-pycreds` and import `dockerpycreds` to use this library. Do not confuse it with `pycreds`.","message":"There is another Python library named `pycreds` (pypi.org/project/pycreds) which is unrelated to Docker credentials. `docker-pycreds` is specifically for integrating with Docker's credential store.","severity":"gotcha","affected_versions":"All versions"},{"fix":"When using `docker-pycreds` in automated scripts or non-interactive environments, ensure that the chosen credential helper backend is configured for non-interactive use, or consider using environment variables for credentials where appropriate and secure.","message":"Operations like `store()`, `get()`, and `delete()` often interact with the operating system's credential store (e.g., keyring, secure vault). This can lead to system-level password prompts, especially for the 'secretservice' backend on Linux, which might cause hangs in non-interactive environments.","severity":"gotcha","affected_versions":"0.1.0 - 0.4.0"}],"env_vars":null,"last_verified":"2026-04-06T00:00:00.000Z","next_check":"2026-07-05T00:00:00.000Z"}