Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Podman #23

Closed
msausu opened this issue Mar 7, 2021 · 6 comments
Closed

Support Podman #23

msausu opened this issue Mar 7, 2021 · 6 comments

Comments

@msausu
Copy link

msausu commented Mar 7, 2021

Is this a BUG REPORT or FEATURE REQUEST?

/kind FEATURE REQUEST

Description

ryuk doesn't work with podman

Context

podman info
host:
  arch: amd64
  buildahVersion: 1.19.4
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.26-1.fc33.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.26, commit: 777074ecdb5e883b9bec233f3630c5e7fa37d521'
  cpus: 8
  distribution:
    distribution: fedora
    version: "33"
  eventLogger: journald
  hostname: fedora
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.10.19-200.fc33.x86_64
  linkmode: dynamic
  memFree: 893497344
  memTotal: 12438728704
  ociRuntime:
    name: crun
    package: crun-0.18-1.fc33.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.18
      commit: 808420efe3dc2b44d6db9f1a3fac8361dde42a95
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    selinuxEnabled: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.8-1.fc33.x86_64
    version: |-
      slirp4netns version 1.1.8
      commit: d361001f495417b880f20329121e3aa431a8f90f
      libslirp: 4.3.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.0
  swapFree: 3499356160
  swapTotal: 4294963200
  uptime: 26h 5m 54.09s (Approximately 1.08 days)
registries:
  search:
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
  - docker.io
store:
  configFile: /home/msa/.config/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 0
    stopped: 2
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: fuse-overlayfs-1.4.0-1.fc33.x86_64
      Version: |-
        fusermount3 version: 3.9.3
        fuse-overlayfs: version 1.4
        FUSE library version 3.9.3
        using FUSE kernel interface version 7.31
  graphRoot: /home/msa/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 35
  runRoot: /run/user/1000/containers
  volumePath: /home/msa/.local/share/containers/storage/volumes
version:
  APIVersion: 3.0.0
  Built: 1613753777
  BuiltTime: Fri Feb 19 13:56:17 2021
  GitCommit: ""
  GoVersion: go1.15.8
  OsArch: linux/amd64
  Version: 3.0.1

Evidence

podman run -it --rm -v $PWD:$PWD -w $PWD -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock docker.io/alpine:3.5 echo ok 
ok
podman run -it --rm -v $PWD:$PWD -w $PWD -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock docker.io/testcontainersofficial/ryuk 
2021/03/07 01:29:28 Pinging Docker...
panic: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

goroutine 1 [running]:
main.main()
	/go/src/github.com/testcontainers/moby-ryuk/main.go:36 +0x457
@bsideup
Copy link
Member

bsideup commented Mar 7, 2021

Ryuk is a technology for Moby (the underlying component of Docker) and Moby-compatible systems.

@veita
Copy link

veita commented Oct 24, 2022

It seems that your run command is wrong.

The Ryuk container needs /var/run/docker.sock to communicate with the container runtime. Thus you have to map the host's /run/user/1000/podman/podman.sock to the container's /var/run/docker.sock:

$ podman run -it --rm -v /run/user/1000/podman/podman.sock:/var/run/docker.sock docker.io/testcontainers/ryuk

The result is

2022/10/24 20:38:42 Pinging Docker...
2022/10/24 20:38:42 Docker daemon is available!
2022/10/24 20:38:42 Starting on port 8080...
2022/10/24 20:38:42 Started!

which suggests that Ryuk is compatible with Podman (even though the wording of the messages is improvable ;-)).

@kiview
Copy link
Member

kiview commented Oct 25, 2022

Thanks a lot for sharing the solution @veita 👍

@fer-marino
Copy link

It seems that your run command is wrong.

The Ryuk container needs /var/run/docker.sock to communicate with the container runtime. Thus you have to map the host's /run/user/1000/podman/podman.sock to the container's /var/run/docker.sock:

$ podman run -it --rm -v /run/user/1000/podman/podman.sock:/var/run/docker.sock docker.io/testcontainers/ryuk

The result is

2022/10/24 20:38:42 Pinging Docker...
2022/10/24 20:38:42 Docker daemon is available!
2022/10/24 20:38:42 Starting on port 8080...
2022/10/24 20:38:42 Started!

which suggests that Ryuk is compatible with Podman (even though the wording of the messages is improvable ;-)).

this is great. But wouldn't it be better if ryuk/testcontainer do it automatically?

@kiview
Copy link
Member

kiview commented Jul 5, 2024

@fer-marino How can the container do the mounting of the socket automatically? Or what are you referering to specifically?

@cvgaviao
Copy link

podman run -it --rm -v /run/user/1000/podman/podman.sock:/var/run/docker.sock docker.io/testcontainers/ryuk

What if I'm using a remote podman ?
I run the ssh below before starting my tests with Quarkus. But I'm disabling Ryuk to do that, unfortunately I always have containers left running there...

ssh -N -L 127.0.0.1:3307:/run/user/35268/podman/podman.sock use@host

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants