Start the Podman socket from the toolbox container (the container where you’re developing):

systemctl --user start podman.socket

Note: 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_HOST environment variable or a ~/.testcontainers.properties file 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=true

Then 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)