2

I am doing Nodejs development within a WSL2 environment in an Ubuntu distribution. To build and run container images I am using podman installed within the ubuntu distribution (podman ubuntu). To write integration tests I want to use testcontainers. Unfortunately, executing tests with testcontainers fails with error: No Docker client strategy found

After some research here, here, here and here I somehow need to create a podman service and forward the DOCKER_HOST to the socket. Unfortunately creating a podman service in ubuntu did not work as commands like systemctl are not working. Therefor I installed podman on windows as described here. (podman windows) As a result there is a podman service installed in a separate WSL2 fedora environment. (podman fedora)

To summarize, there is podman (fedora), podman (windows) and podman (ubuntu).

The communication between podman (windows) to podman (fedora) works very well. I tried to set the very same connection to podman (ubuntu) but unfortunately this connection does not work. Podman accepts the connection but always returns the local dataset instead of the dataset of podman (fedora). I manually opened a ssh connection and assigned the socket to the DOCKER_HOST as described here. This works fine but the test fails as it cannot find the image. The image is not found as the image is build with podman (ubuntu) but testcontainers is looking within podman (fedora).

Any ideas what needs to be done to connect the podman (ubuntu) to podman (fedora)? Or any other idea to get the setup up and running in WSL2 and Ubuntu?

chaosbohne
  • 2,454
  • 2
  • 22
  • 27
  • 1
    Maybe this is not helpful, but may I ask why you are not using Docker inside Ubuntu since this would fundamentally simplify the setup? You don't need to use Docker Desktop, you can natively install the OSS Docker into the WSL2 Ubuntu environment. – Kevin Wittek Jun 29 '22 at 10:32
  • If there is no solution, this will be the way to go. – chaosbohne Jun 29 '22 at 11:46
  • May I ask why you trie to shoehorn podman into this Windows setup in the first place? – Kevin Wittek Jul 01 '22 at 11:46
  • Seems like testcontainers wants to talk to podman having a socket. To enable the socket I need to run podman as a service. I was not able to run podman as a service within my WSL. Command 'systemctl' is not available and command 'service' does not list podman. – chaosbohne Jul 04 '22 at 09:04
  • That is the effect of podman, right. But why are you using podman, and not either Docker Desktop, or Docker engine within WSL2? Besides, Testcontainers interacts with a Docker REST-API, correct. – Kevin Wittek Jul 05 '22 at 12:14
  • 1
    Simply interest, just wanted to get rid of docker moving more towards oci compliance. For now I installed the docker cli and daemon which works just fine. – chaosbohne Jul 14 '22 at 07:48
  • 1
    Good to hear that CLI and daemon works as expected, thanks for sharing :) – Kevin Wittek Jul 15 '22 at 07:59
  • 1
    Systemd support is now available in WS2. Did you try that? https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/ – joecracker Jan 18 '23 at 13:50

1 Answers1

0

The tips is to start a sock 1 time after WSL2 startup

podman system service -t 0 unix:///tmp/podman.sock &
export DOCKER_HOST=unix:///tmp/podman.sock

testcontainers config

checks.disable=true