Skip to content

Bug: ServerContainer hangs indefinitely waiting for ryuk to start #741

Description

@mmwinther

Describe the bug

Running a test with a pytest fixture starting a ServerContainer results in an indefinitely hanging test with no errors or logs.

Observing the docker logs, I see that a testcontainers/ryuk:0.8.1 container is started, prints the startup log (see below) and then eventually stops. Through this entire process testcontainers-python hangs on the same log line and never times out.

Logs from pytest:

Starting container with image: quay.io/microcks/microcks-uber:1.10.1-native
using host unix:///Users/mmw/.colima/docker.sock
using host unix:///Users/mmw/.colima/docker.sock
Pulling image testcontainers/ryuk:0.8.1
Container started: 70bc0a7ee6ef
Waiting for container <Container: 70bc0a7ee6ef> with image testcontainers/ryuk:0.8.1 to be ready ...
Run instance cancelled.

Logs from ryuk docker container:

2024/11/25 09:29:22 Pinging Docker...
2024/11/25 09:29:22 Docker daemon is available!
2024/11/25 09:29:22 Starting on port 8080...
2024/11/25 09:29:22 Started!

To Reproduce

Provide a self-contained code snippet that illustrates the bug or unexpected behavior. Ideally, send a Pull Request to illustrate with a test that illustrates the problem.

withServerContainer(
image="quay.io/microcks/microcks-uber:1.10.1-native",
port=9000,
) ascontainer:
print(f"Started container")

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.

Darwin Miless MacBook Pro 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_X86_64 x86_64
Python 3.12.7
poetry show testcontainers
name : testcontainers
version : 4.8.2
description : Python library for throwaway instances of anything that can run in a Docker container
dependencies
- docker *
- httpx *
- redis *
- typing-extensions *
- urllib3 *
- wrapt *
Client: Docker Engine - Community
Version: 27.3.1
Context: default
Debug Mode: false
Plugins:
compose: Docker Compose (Docker Inc.)
Version: 2.29.7
Path: /usr/local/lib/docker/cli-plugins/docker-compose
Server:
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 39
Server Version: 26.1.1
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
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: e377cd56a71523140ca6ae87e30244719194a521
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.8.0-31-generic
Operating System: Ubuntu 24.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.916GiB
Name: colima
ID: 10b03733-f7b9-4443-84b0-05aed75e2124
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

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