Path for docker command in ocurrent

Hi, I am new to ocurrent and learning it via its examples in the doc.

My question is how ocurrent finds the path for docker.

I am using wsl2. I installed a legacy Docker for Windows, so I have seen this before

The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.

However, today I installed podman as a docker alternative (for fun).
Then I removed the soft links in /bin/docker and /usr/bin/docker and make a new softlink to podman instead.

⋊> which -a docker
/bin/docker
/usr/bin/docker
/bin/docker
/mnt/c/Program Files/Docker/Docker/resources/bin/docker

⋊> ls -al /bin/docker | grep docker
lrwxrwxrwx 1 root root 6 Jan 26 23:38 /bin/docker -> podman

⋊> ls -al /usr/bin/docker | grep docker
lrwxrwxrwx 1 root root 6 Jan 26 23:38 /usr/bin/docker -> podman

The result is the same for both my shell and /bin/sh/. I can run the fake docker on my own.

The strange thing is I can still read the error message for the legacy docker in the ocurrent log.

2022-01-27 04:05.07: Exec: "docker" "build" "-f" "/tmp/git-checkout29b7fa22/Dockerfile" 
                           "--iidfile" "/tmp/git-checkout29b7fa22/docker-iid" 
                           "--" "/tmp/git-checkout29b7fa22"
The command 'docker' could not be found in this WSL 2 distro.
We recommend to activate the WSL integration in Docker Desktop settings.

I wonder how the ocurrent find the paths for a command e.g. docker and then I can think how to fix my problem.

The log message is printed here:

So, it’s passing ("", [| "docker"; ... |]) to Lwt_process.open_process.

"" means to look for it in PATH.

I’d test it from utop. e.g.

utop # #require "lwt.unix";;
utop # let p = Lwt_process.open_process ("", [| "docker"; "info" |]);;
val p : Lwt_process.process = <obj>
utop # Lwt_io.read p#stdout;;
- : string =
"Client: ...
4 Likes

Thanks! That’s the code I am looking for. I also test it in my utop.

utop # #require "lwt.unix";;
utop # let p = Lwt_process.open_process ("", [| "docker"; "info" |]);;
val p : Lwt_process.process = <obj>

utop # Lwt_io.read p#stdout;;
- : string =
... " ... package: 'conmon: /usr/libexec/podman/conmon'\n    path: /usr/libexec/podman/conmon\n    version: 'conmon version 2.0.30, commit: '\n  cpus: 32\n  distribution:\n    codename:"... (* string length 2875; truncated *)

I am thinking it loads the correct fake docker here while the logging inside ocurrent as you pointed.

I will debug it.

edit: Got it. It’s a silly mistake. The log was outdated before I made the softlink. It works now after I clean the old sqlite files. Maybe I will learn how is the canonical way to delete the old logs later.

Interested to see whether podman works, please share your findings.