You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
container = DockerCompose('.', dockerfile, pull=True)
container.start()
wait_for_logs(container, 'Connected with result code 0', timeout=60)
Output:
container = <testcontainers.compose.DockerCompose object at 0x10fd9a7c0>, predicate = <built-in method search of re.Pattern object at 0x7fe22e561000>, timeout = 60, interval = 1
def wait_for_logs(container, predicate, timeout=None, interval=1):
"""
Wait for the container to emit logs satisfying the predicate.
Parameters
----------
container : DockerContainer
Container whose logs to wait for.
predicate : callable or str
Predicate that should be satisfied by the logs. If a string, the it is used as the pattern
for a multiline regular expression search.
timeout : float or None
Number of seconds to wait for the predicate to be satisfied. Defaults to wait indefinitely.
interval : float
Interval at which to poll the logs.
Returns
-------
duration : float
Number of seconds until the predicate was satisfied.
"""
if isinstance(predicate, str):
predicate = re.compile(predicate, re.MULTILINE).search
start = time.time()
while True:
duration = time.time() - start
> if predicate(container._container.logs().decode()):
E AttributeError: 'DockerCompose' object has no attribute '_container'
../../venv/lib/python3.9/site-packages/testcontainers/core/waiting_utils.py:87: AttributeError
The text was updated successfully, but these errors were encountered:
Example code:
Output:
The text was updated successfully, but these errors were encountered: