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

Error if URI exceeds 64 characters #197

Open
muzammil786 opened this issue Jul 30, 2022 · 3 comments
Open

Error if URI exceeds 64 characters #197

muzammil786 opened this issue Jul 30, 2022 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@muzammil786
Copy link

muzammil786 commented Jul 30, 2022

I have a uri like this

uri = "unix:///Users/muzammil.shahbaz/.local/share/containers/podman/machine/podman-machine-default/podman.sock"
This exceeds the standard 64 characters.

On execution, I get the following error:

Exception has occurred: UnicodeError
encoding with 'idna' codec failed (UnicodeError: label empty or too long)

The above exception was the direct cause of the following exception:

  File "../podmanclient.py", line 12, in <module>
    version = client.version()

A potential fix would be to encode the URL to base64 and handle decoding in the code.

I am using podman version 4.1.1 on OSX using qemu virtual machine.

@rhatdan
Copy link
Member

rhatdan commented Jul 30, 2022

You can open the file and then use the path to the fd. In Go we do this with.

	fd, err := unix.Open(path, unix.O_PATH, 0)
	if err != nil {
		return nil, err
	}
	defer unix.Close(fd)
	return net.DialUnix("unixpacket", nil, &net.UnixAddr{Name: fmt.Sprintf("/proc/self/fd/%d", fd), Net: "unixpacket"})
}

@muzammil786
Copy link
Author

You can open the file and then use the path to the fd. In Go we do this with.

	fd, err := unix.Open(path, unix.O_PATH, 0)
	if err != nil {
		return nil, err
	}
	defer unix.Close(fd)
	return net.DialUnix("unixpacket", nil, &net.UnixAddr{Name: fmt.Sprintf("/proc/self/fd/%d", fd), Net: "unixpacket"})
}

Any idea how to do in python pls?

@WisdomWolf
Copy link

I couldn't quite figure out how to get the path to the file descriptor the way that they do with Go, but I found a different (albeit clunky) workaround here. It creates an SSH tunnel to a socket in a much easier to access (and shorter path) location: /tmp/podman.sock. Its neither ideal nor pretty, but it gets the job done.

  > podman system connection ls

  # Create tunnel
  > ssh -nNT -L/tmp/podman.sock:/run/user/1000/podman/podman.sock -i ~/.ssh/podman-machine-default ssh://core@localhost:[PORT]

  # Export socket location
  > export DOCKER_HOST='unix:///tmp/podman.sock'```

@umohnani8 umohnani8 added the help wanted Extra attention is needed label Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants