GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Bug: Error while fetching server API version · Issue #757 · testcontainers/testcontainers-python

Bug: Error while fetching server API version #757

New issue
Copy link
New issue
Copy link
Open
Open
Bug: Error while fetching server API version#757
Copy link

Description

@Goldziher
Goldziher
opened on Jan 9, 2025
Issue body actions

Describe the bug

The library is raising a DockerException when trying to fetch the server version. I saw multiple older issues related to this issue, but it's now repeating.

To Reproduce

def create_container():
    container = PostgresContainer("pgvector/pgvector:pg17", driver=None)
    container.start()

Runtime environment

  • M1 Pro
  • Python 3.12.8
  • Docker Desktop 4.37.2 (179585)
  • Testcontainers 4.9.0 installed via uv

Results of running docker context ls:

NAME              DESCRIPTION                               DOCKER ENDPOINT                                          ERROR
default           Current DOCKER_HOST based configuration   unix:///var/run/docker.sock
desktop-linux *   Docker Desktop                            unix:///Users/naamanhirschfeld/.docker/run/docker.sock
Reacted by Tomas and Vincent Emonet

Activity

  1. techanfa commented on Jan 12, 2025

    @techanfa
    techanfa
    on Jan 12, 2025
    More actions

    Same issue for
    M3 chip,
    Docker desktop 4.37.1
    testcontainers 4.9.0 installed via poetry.
    Same output from docker context ls

  2. alexanderankin commented on Jan 13, 2025

    @alexanderankin
    alexanderankin
    on Jan 13, 2025
    Member
    More actions

    My guess is that this is happening with one of the components maintained by docker, either docker desktop or the python docker client, we don't really have docker desktop in the cicd, it's not so easy to install there. I'll try to take a look if it's that, see if upgrading the python docker client helps, in case it's not the latest or something. There have been instances of python requests library causing issues as well

  3. Goldziher commented on Jan 13, 2025

    @Goldziher
    Goldziher
    on Jan 13, 2025
    Author
    More actions

    My guess is that this is happening with one of the components maintained by docker, either docker desktop or the python docker client, we don't really have docker desktop in the cicd, it's not so easy to install there. I'll try to take a look if it's that, see if upgrading the python docker client helps, in case it's not the latest or something. There have been instances of python requests library causing issues as well

    Thank you. I reinstalled docker desktop, cleaned everything up, and restarted, and... It magically resolved.

    I hate it when things are so obscure, but at least my tests are passing again.

    I imagine it is something in docker desktop that is fucking things up.

    Weirdly though, I was able to communicate with docker normally even when the test container library was not.

  4. jacobmiller22 commented on Jan 13, 2025

    @jacobmiller22
    jacobmiller22
    on Jan 13, 2025
    More actions

    Same issue, had to reinstall docker desktop after macos Sequoia update.

  5. laurens-teirlynck commented on Feb 11, 2025

    @laurens-teirlynck
    laurens-teirlynck
    on Feb 11, 2025
    More actions

    I've also managed to fix the same issue by re-installing Docker after a Mac update. Maybe this issue can be closed since it doesn't seem to be caused by testcontainers itself.

    Reacted by Fritz Stelluto
  6. levrik commented on Apr 1, 2025

    @levrik
    levrik
    on Apr 1, 2025
    More actions

    I compared the locations of the .sock files of both pre-configured contexts between my system and the one of a colleague who doesn't have this issue. For him there's a symbolic link from /var/run/docker.sock (default context) to ~/.docker/run/docker.sock (linux-desktop context) which is missing from my system.

    I manually created it on my machine via sudo ln -s ~/.docker/run/docker.sock /var/run/docker.sock which fixes the issue. No re-install needed.

    Reacted by Vincent Emonet
  7. Goldziher commented on Apr 1, 2025

    @Goldziher
    Goldziher
    on Apr 1, 2025
    Author
    More actions

    I switched to using colima, and test-containers completely fails.

  8. vemonet commented on Apr 28, 2025

    @vemonet
    vemonet
    on Apr 28, 2025
    More actions

    @levrik solution works

    There was issues with testcontainers not capable of finding the docker socket if it was not in the traditional path /var/run/docker.sock

    It was recently fixed here: 6817582 it might work out of the box since this change, but it has not yet been released

  9. kiview commented on Apr 28, 2025

    @kiview
    kiview
    on Apr 28, 2025
    Member
    More actions

    For better triaging and debugging (for users, but also us maintainers), it seems useful to fail with a clearer error message, if there are issues when communicating (or even finding) the right Docker socket.

  10. peacefulseeker commented on Jun 3, 2026

    @peacefulseeker
    peacefulseeker
    on Jun 3, 2026
    More actions

    In case anyone else uses Rancher Desktop,
    the symlink approach seems quickest to fix the issue raised here:
    sudo ln -sf /Users/$USER/.rd/docker.sock /var/run/docker.sock

  11. Tranquility2 commented on Jun 6, 2026

    @Tranquility2
    Tranquility2
    on Jun 6, 2026
    Contributor
    More actions

    This is likely worth re-checking now that a couple of relevant changes have landed for 4.15.0:

    • feat(core): auto-detect DOCKER_HOST from current docker context #1026 makes testcontainers auto-detect DOCKER_HOST from the active docker context.
      In the original report the active context is desktop-linux (pointing at ~/.docker/run/docker.sock), so testcontainers should now use that socket automatically instead of falling back to /var/run/docker.sock, which removes the need for the ln -s workaround.
      This should also cover the Colima case from the later comment, since Colima registers its own docker context pointing at ~/.colima/default/docker.sock.
    • feat(core): add Podman compatibility #1028 adds Podman compatibility, for anyone running Podman rather than Docker.

    These build on the earlier rootless-socket fix (#779).

    So for anyone still hitting this: could you retry on 4.15.0 (once released) and report back?
    One caveat: the context auto-detection only kicks in when your active context is non-default. A misconfigured default context still relies on the rootless-socket handling from #779.

  12. alexanderankin
    added a commit that references this issue on Jun 10, 2026

    fix(core): make is_podman respect resolved docker host (#1048)

    6018da3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.