Open jorgepsmatos opened 1 week ago
Hi @jorgepsmatos the current DockerProvider struct can be created for Podman: https://github.com/testcontainers/testcontainers-go/blob/main/provider.go#L119-L125
Can you verify if setting the provider in the GenericContainerRequest
helps you here?
With the ProviderType like this:
req := testcontainers.ContainerRequest{
Image: "postgres:12",
Env: map[string]string{
"POSTGRES_USER": dbUser,
"POSTGRES_PASSWORD": dbPassword,
"POSTGRES_DB": dbName,
},
ExposedPorts: []string{"5432/tcp"},
Cmd: []string{"postgres", "-c", "fsync=off"},
WaitingFor: wait.ForLog("database system is ready to accept connections").WithStartupTimeout(5 * time.Second),
}
genericContainerReq := testcontainers.GenericContainerRequest{
ContainerRequest: req,
Started: true,
ProviderType: testcontainers.ProviderPodman,
}
postgresContainer, err := testcontainers.GenericContainer(ctx, genericContainerReq)
I get another error:
create container: started hook: wait until ready: get state: Error response from daemon: no container with name or ID "b58a314d3c65bf52772c406ea584299bd9689048e61ac6b10268fbbf3ecce182" found: no such container: could not start container: creating reaper failed
Besides, since this code is supposed to be shared by a team and has to run in a GitLab pipeline without podman I would prefer to keep it generic
You probably have read https://golang.testcontainers.org/system_requirements/using_podman/, so I'm not sure what's going on (I do not have a Windows machine at hand).
FYI we are planning to remove the Provider abstraction in an eventual v1
(see https://github.com/testcontainers/testcontainers-go/tree/v1), so we expect that the container runtime should be located simply by the existing discovery mechanism: https://golang.testcontainers.org/features/configuration/#docker-host-detection.
I'll keep investigating when I have time and share my findings here.
Regarding the second point, that is acceptable for us, we're already setting DOCKER_HOST on our CI, and locally each dev should do it too
Testcontainers version
0.33.0
Using the latest Testcontainers version?
Yes
Host OS
Windows 10
Host arch
x86
Go version
1.23
Docker version
Docker info
What happened?
I get the following error when trying to run on Windows:
With TESTCONTAINERS_RYUK_DISABLE=true this does not happen, but I would like to get it working with ryuk too.
According to this issue on the podman repo https://github.com/containers/podman/issues/14983, the api responds that the "bridge" network exists even tough it doesn't, so I would assume it would be enough to trick testcontainers into finding it
I used this python script to test the API through the socket and it does respond succesfully stating the bridge network exists so I assume the issue is really on testcontainers side
Response:
Relevant log output
Additional information
code sample: