Start the Podman socket from the toolbox container (the container where you’re developing):
systemctl --user start podman.socketNote: I ran this from inside a Toolbx container running on Fedora 40
Configure Testcontainers to use Podman’s socket:
- Save the following exports to
~/.testcontainers.properties - You can tell Testcontainers where to look for the docker host. Use the the
DOCKER_HOSTenvironment variable or a~/.testcontainers.propertiesfile to determine the Docker daemon’s location (as per Testcontainers for Java)
export DOCKER_HOST="unix://${XDG_RUNTIME_DIR}/podman/podman.sock"Also set the RYUK to false because Podman doesn’t have a Ryuk component:
export TESTCONTAINERS_RYUK_DISABLED=trueThen you can test it out:
from testcontainers.postgres import PostgresContainer
with PostgresContainer("postgres:16") as postgres:
psql_url = postgres.get_connection_url()
print(psql_url)