testcontainers-go: [Bug]: Ryuk does not work with podman
Testcontainers version
0.28
Using the latest Testcontainers version?
Yes
Host OS
MacOs
Host arch
ARM
Go version
1.22
Docker version
Client: Docker Engine - Community
Version: 25.0.3
API version: 1.41 (downgraded from 1.44)
Go version: go1.21.6
Git commit: 4debf411d1
Built: Tue Feb 6 20:42:40 2024
OS/Arch: darwin/arm64
Context: default
Server: linux/arm64/fedora-39
Podman Engine:
Version: 4.9.0
APIVersion: 4.9.0
Arch: arm64
BuildTime: 2024-01-24T11:07:09+01:00
Experimental: false
GitCommit:
GoVersion: go1.21.6
KernelVersion: 6.7.4-200.fc39.aarch64
MinAPIVersion: 4.0.0
Os: linux
Conmon:
Version: conmon version 2.1.8, commit:
Package: conmon-2.1.8-2.fc39.aarch64
OCI Runtime (crun):
Version: crun version 1.14
commit: 667e6ebd4e2442d39512e63215e79d693d0780aa
rundir: /run/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
Package: crun-1.14-1.fc39.aarch64
Engine:
Version: 4.9.0
API version: 1.41 (minimum version 1.24)
Go version: go1.21.6
Git commit:
Built: Wed Jan 24 11:07:09 2024
OS/Arch: linux/arm64
Experimental: false
Docker info
Client: Docker Engine - Community
Version: 25.0.3
Context: default
Debug Mode: false
Plugins:
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 1
Server Version: 4.9.0
Storage Driver: overlay
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: false
Using metacopy: true
Supports shifting: true
Supports volatile: true
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge macvlan ipvlan
Log: k8s-file none passthrough journald
Swarm: inactive
Runtimes: kata krun runj youki crun crun-wasm ocijail runc runsc
Default Runtime: crun
Init Binary:
containerd version:
runc version:
init version:
Security Options:
seccomp
Profile: default
selinux
Kernel Version: 6.7.4-200.fc39.aarch64
Operating System: fedora
OSType: linux
Architecture: arm64
CPUs: 4
Total Memory: 1.904GiB
Name: localhost.localdomain
ID: c9c1ca7e-0a95-4d0d-b573-b82806d74d03
Docker Root Dir: /var/lib/containers/storage
Debug Mode: false
Experimental: true
Live Restore Enabled: false
Product License: Apache-2.0
WARNING: No swap limit support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
WARNING: No cpu shares support
WARNING: No cpuset support
WARNING: IPv4 forwarding is disabled
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
What happened?
I wanted to switch from docker-desktop to podman as docker provider on MacOs. Everything works but only if I disable ryuk. Otherwise testcontainer crashes at boot up with
getting request provider: Error response from daemon: container create: unable to find network with name or ID bridge: network not found: creating reaper failed: failed to create container
Any idea how to fix this? I have tried everything that I can google, podman is run as rootful and the socket is correctly configured. Testcontainers with ryuk disabled works as expected but it would be nice if it would just work without requiring disabling it.
Relevant log output
No response
Additional information
I am using this project to trigger the issue in case you want to reproduce: https://github.com/dfioravanti/go-rest. Just run go test ./... in the root.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 17 (5 by maintainers)
I finally tracked my error to something between
v0.13.0(OK) andv0.14.0. Debugging how ryuk containers where created I saw this diff among others:I found 2 fixes (I prefer the first one):
Setting
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDEenv variable to/var/run/docker.sock. I previously tried setting it to colima’s docker.sock and it still failed. And keep yourDOCKER_HOSTenv variable asunix:////Users/$USER/.colima/docker.sockwith your particular user.Linking the
/var/run/docker.sockto colima’s docker.sock and removing theDOCKER_HOSTenv variable that was pointing to colima.@dfioravanti we are working on https://github.com/docker/go-sdk too, which will help simplifying testcontainers-go, and any Go project managing containers. This library already comes the context support to talk to different container alternatives, and I’m currently building a branch for using the new docker sdk atm. I’ve tested that SDK locally with podman, colima, orbstack and docker, so even though the branch here is stale for 9 months (my bad), it will be eventually addressed with the usage of the SDK.
On our side, it’s great that you still want to use testcontainers!
Jokes aside, I need to go back to that PR to test against the latest podman. I recall it worked at that time, but need to double check
Hello, just a note to know if it’s still worked on ? I’m hitting this issue with the last testcontainer-go version and I tried with your PR also and it did not work.
I guess the scope of the issue is understood but If I can do anything to help I’ll be glad to do so. It’s a bit sad to have to re-install docker just after switching to podman 😅
Same here, tested with
colimaandrancher-desktopand ryuk fails to start (it exits as soon as it is started). Tested same code with Docker Desktop and it works OK.It fails 95% of the times in my case.
Using
testcontainers-go v0.31.0I tried changing the version of ryuk but got the same results.
I debugged the process and found it fails here, between the
CreateContainerand theStart.Tested with the Quickstart example
I ran into this issue on a setup similar to the original poster.
@godart, I tried your fix, but I kept running into this issue:
I even tried setting my
DOCKER_HOSTto point to my podman socket withDOCKER_HOST=unix:///Users/user/.local/share/containers/podman/machine/podman.sockwhich got rid of the permissions issue but still yielded an error:Did you not run into this issue?
I debugged a bit:
The current auto-detection of Podman looks for “podman.sock” within the socket name. This works with Podman on Linux, but when using
podman-mac-helperfor MacOS, the socket name (on the host) is/var/run/docker.sock. (https://github.com/testcontainers/testcontainers-go/blob/main/provider.go#L106)Setting
ProviderTypein the test code like thisfixes the network configuration issue. Also the PR https://github.com/testcontainers/testcontainers-go/pull/1990 addresses this with a global configuration option. However this has been stale for a bit.
Maybe the
/infoor/versioncalls could be scraped to detect the server is actually Podman instead.