Skip to content

Instantly share code, notes, and snippets.

@FrendaWinter
Created April 2, 2024 10:41
Show Gist options
  • Save FrendaWinter/4a7fb965caf9d8a099cdc5ed41a7144e to your computer and use it in GitHub Desktop.
Save FrendaWinter/4a7fb965caf9d8a099cdc5ed41a7144e to your computer and use it in GitHub Desktop.
Python testcontainers note

Install package

pip install testcontainers

Start docker

sudo systemctl status docker

sudo systemctl start docker

Example code

from testcontainers.core.container import DockerContainer

from testcontainers.core.waiting_utils import wait_for_logs

with DockerContainer("hello-world") as container:

   delay = wait_for_logs(container, "Hello from Docker!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment