Bug: Not able to start basic example with Postgres with macos
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 52/100
Direção de pesquisa
Reproduza o exemplo básico de PostgresContainer no macOS com Docker Desktop usando as versões informadas de Python, Docker e testcontainers. Comece em PostgresContainer e na inicialização de DockerClient mostrada no traceback; em seguida, rastreie como o host do Docker é formado. Está concluído quando o exemplo se conecta com sucesso sem o erro de host tcp malformado.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
I'm trying to run the basic example that appears in the documentation in macos Sequoia 15.4 with M2 chip and testcontainers is not able to connect to docker engine due to incorrect host.
To Reproduce
Python 3.12.6 (v3.12.6:a4a2d2b0d85, Sep 6 2024, 16:08:03) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> with PostgresContainer("postgres:16") as postgres:
... psql_url = postgres.get_connection_url()
... engine = sqlalchemy.create_engine(psql_url)
... with engine.begin() as connection:
... version, = connection.execute(sqlalchemy.text("SELECT version()")).fetchone()
...
KeyboardInterrupt
>>>
KeyboardInterrupt
>>> from testcontainers.postgres import PostgresContainer
>>> import sqlalchemy
>>> with PostgresContainer("postgres:16") as postgres:
... psql_url = postgres.get_connection_url()
... engine = sqlalchemy.create_engine(psql_url)
... with engine.begin() as connection:
... version, = connection.execute(sqlalchemy.text("SELECT version()")).fetchone()
...
using host tcp\://127.0.0.1\:49693
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ves/Projects/game-api/.venv/lib/python3.12/site-packages/testcontainers/postgres/__init__.py", line 59, in __init__
super().__init__(image=image, **kwargs)
File "/Users/ves/Projects/game-api/.venv/lib/python3.12/site-packages/testcontainers/core/container.py", line 50, in __init__
self._docker = DockerClient(**(docker_client_kw or {}))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ves/Projects/game-api/.venv/lib/python3.12/site-packages/testcontainers/core/docker_client.py", line 68, in __init__
self.client = docker.from_env(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ves/Projects/game-api/.venv/lib/python3.12/site-packages/docker/client.py", line 94, in from_env
return cls(
^^^^
File "/Users/ves/Projects/game-api/.venv/lib/python3.12/site-packages/docker/client.py", line 45, in __init__
self.api = APIClient(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ves/Projects/game-api/.venv/lib/python3.12/site-packages/docker/api/client.py", line 146, in __init__
base_url = utils.parse_host(
^^^^^^^^^^^^^^^^^
File "/Users/ves/Projects/game-api/.venv/lib/python3.12/site-packages/docker/utils/utils.py", line 296, in parse_host
raise errors.DockerException(
docker.errors.DockerException: Invalid bind address format: port is required: tcp\://127.0.0.1\:49693
Runtime environment
Provide a summary of your runtime environment. Which operating system, python version, and docker version are you using? What is the version of testcontainers-python you are using? You can run the following commands to get the relevant information.
# Get the operating system information (on a unix os).
$ uname -a
Darwin NB230915VES 24.4.0 Darwin Kernel Version 24.4.0: Wed Mar 19 21:17:25 PDT 2025; root:xnu-11417.101.15~1/RELEASE_ARM64_T6020 arm64
# Get the python version.
$ python --version
Python 3.12.6
# Get the docker version and other docker information.
$ docker info
docker info
Client:
Version: 28.0.4
Context: desktop-linux
Debug Mode: false
Plugins:
ai: Docker AI Agent - Ask Gordon (Docker Inc.)
Version: v1.1.3
Path: /Users/ves/.docker/cli-plugins/docker-ai
buildx: Docker Buildx (Docker Inc.)
Version: v0.22.0-desktop.1
Path: /Users/ves/.docker/cli-plugins/docker-buildx
cloud: Docker Cloud (Docker Inc.)
Version: 0.2.20
Path: /Users/ves/.docker/cli-plugins/docker-cloud
compose: Docker Compose (Docker Inc.)
Version: v2.34.0-desktop.1
Path: /Users/ves/.docker/cli-plugins/docker-compose
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.38
Path: /Users/ves/.docker/cli-plugins/docker-debug
desktop: Docker Desktop commands (Beta) (Docker Inc.)
Version: v0.1.6
Path: /Users/ves/.docker/cli-plugins/docker-desktop
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: /Users/ves/.docker/cli-plugins/docker-dev
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.27
Path: /Users/ves/.docker/cli-plugins/docker-extension
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.4.0
Path: /Users/ves/.docker/cli-plugins/docker-init
model: Docker Model Runner (Docker Inc.)
Version: v0.1.4
Path: /Users/ves/.docker/cli-plugins/docker-model
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /Users/ves/.docker/cli-plugins/docker-sbom
scout: Docker Scout (Docker Inc.)
Version: v1.17.0
Path: /Users/ves/.docker/cli-plugins/docker-scout
WARNING: Plugin "/Users/ves/.docker/cli-plugins/docker-feedback" is not valid: failed to fetch metadata: fork/exec /Users/ves/.docker/cli-plugins/docker-feedback: no such file or directory
Server:
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 104
Server Version: 28.0.4
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
CDI spec directories:
/etc/cdi
/var/run/cdi
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 753481ec61c7c8955a23d6ff7bc8e4daed455734
runc version: v1.2.5-0-g59923ef
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
cgroupns
Kernel Version: 6.10.14-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: aarch64
CPUs: 12
Total Memory: 7.653GiB
Name: docker-desktop
ID: ************************************
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=unix:///Users/ves/Library/Containers/com.docker.docker/Data/docker-cli.sock
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
::1/128
*********/8
Live Restore Enabled: false
WARNING: DOCKER_INSECURE_NO_IPTABLES_RAW is set
WARNING: daemon is not using the default seccomp profile
# Get all python packages.
$ pip freeze
alembic==1.15.2
blinker==1.9.0
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
dependency-injector==4.42.0
docker==7.1.0
dotenv==0.9.9
Flask==3.1.0
flask-marshmallow==1.3.0
Flask-Migrate==4.1.0
Flask-SQLAlchemy==3.1.1
idna==3.10
iniconfig==2.1.0
itsdangerous==2.2.0
Jinja2==3.1.6
Mako==1.3.9
MarkupSafe==3.0.2
marshmallow==3.26.1
marshmallow-sqlalchemy==1.4.1
packaging==24.2
pluggy==1.5.0
psycopg2-binary==2.9.10
pytest==8.3.5
python-dotenv==1.1.0
requests==2.32.3
ruff==0.11.2
six==1.16.0
SQLAlchemy==2.0.40
testcontainers==4.10.0
typing_extensions==4.13.0
urllib3==2.3.0
Werkzeug==3.1.3
wrapt==1.17.2
- Linguagem predominante
- Python
- Estrelas
- 2.3k
- Forks
- 397
- Merge médio
- 8d 16h
- PRs com merge (30d)
- 5
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de testcontainers/testcontainers-python
-
Feature: Stream bytes out on copy_from_containerTalvez já em andamento @archit15singh assumiu há 11 dias. Aberta🚀 enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
-
Bug: HttpWaitStrategy ignores response predicates for accepted HTTP error statusesTalvez já em andamento @PranavMulakala assumiu há 41 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
-
Bug: LogMessageWaitStrategy: a container that exits before its message raises without its logs, and __enter__ then removes the containerTalvez já em andamento @granzer69 assumiu há 42 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
-
Updating the documentationAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
testcontainers/testcontainers-python#1086 · 1 comentário ·
-
Bug: [minio] _healthcheck calls for nested wait_container_is_ready resulting in long wait timeAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
testcontainers/testcontainers-python#578 · 5 comentários ·
Todas as issues de testcontainers/testcontainers-python
Issues semelhantes
-
bug feature request
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 66/100
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Qiskit/qiskit-obp#156 ·
-
perf(batch-jobs): discover-misses reads the state list without running the whole stage reportAbertaaction-item enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
getcommunityone/open-navigator#1658 ·
Mantenedores costumam responder em até 1 dia
-
review-panel severity:low
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
kristovatlas/coin-accounting#636 ·
Mantenedores costumam responder em até 1 dia