'SSH Portforwarding on socket: Address already in use (Podman)

I am trying to setup a portforwarding with podman on Mac so that applications running on the Mac, can use the podman.sock file e.g. for Docker compatibility.

I got this to run once with the following setup (the podman command is probably not as relevant, but set the context):

$ podman machine start
$ podman system connection list // determine the port for the following command
$ ssh -i ~/.ssh/podman-machine-default core@localhost -p 53136 -L'/tmp/podman.sock:/run/user/podman/podman.sock'

When I execute that command, the following response is being printed and I am being ssh'd into the podman virtual machine:

unix_listener: cannot bind to path /tmp/podman.sock: Address already in use
Could not request local forwarding.

If I now try to find out which process is already using the socket, I get results, but /tmp/podman.sock is not one of them

lsof | grep tmp

When I check for the port of the SSH command above to see which PID is using that port, I get a result:

lsof -ti:53136

That PID however is the podman VM. If I kill the PID, the VM is dead as well. Starting is again results in the same state it seems



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source