{"library":"testcontainers","code":"from testcontainers.core.container import DockerContainer\nfrom testcontainers.core.waiting_it import wait_for_log\n\n# Start a simple Alpine container that outputs a message after a delay\n# using a specific version for stability\nwith DockerContainer(\"alpine:3.17.3\") \\\n    .with_command(\"sh -c 'sleep 2 && echo \\\"Container is ready!\\\" && tail -f /dev/null'\") \\\n    .with_wait_for_service(wait_for_log(\"Container is ready!\", timeout=10)) as alpine_container:\n\n    print(\"Alpine container started and 'Container is ready!' message detected.\")\n    # You can access container logs for verification\n    logs = alpine_container.get_logs()\n    if b\"Container is ready!\" in logs:\n        print(\"Successfully found 'Container is ready!' in logs.\")\n    else:\n        print(\"Error: 'Container is ready!' not found in logs.\")\n    assert b\"Container is ready!\" in logs, \"Expected log message not found.\"\n\nprint(\"Container stopped and removed.\")","lang":"python","description":"This quickstart demonstrates how to use a generic `DockerContainer` with a custom command and a `wait_for_log` strategy to ensure the container is ready. The container automatically stops and cleans up upon exiting the `with` block.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}