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

"handle is invalid" error for volume inspection/creation but not for pod creation during a podman-compose up (On windows) #336

Closed
ultymatom opened this issue Sep 9, 2021 · 7 comments

Comments

@ultymatom
Copy link

Hello,

I'm trying to use podman-compose on windows, I've got podman configure with minikube (so podman remote on my windows and a VM is created by Minikube to run podman), I don't have any problem with podman, everything is working perfectly.

But with podman-compose I've got an issue.

I'm learning podman so I started with the apps that were used for a pluralsight class (that worked well when I was using docker).

it starts by creating a pod, which completes succesfully, then it inspects the volumes defined in the docker-compose.yml (or create it if it does not exist), But this part fails with "handle is invalid" (I'm not totally sure what it means but as I understood it, it means my Podman is not good for execution Podman command (sry I may be totally wrong but I'm a beginner :D) ) for both inspection and creation of the volume.

I noticed that in the podman-compose.py, the creation of the pod is done by the function run of the class Podman, and for the 2 others (inspection and creation of a volume) it's done by the function output of the same class.

they both use the module subprocess, run uses Popen, and output uses check_output. So I modify the script so that the inspection of the volume is executed thanks to run and not output (so Popen instead of check_output).
And the command is successful (I managed to display the json that I have if I do the podman inspect by myself), the "podman-compose up" still finishes with error because the return of the two functions are not similar, but it looks like Popen and check_output does not execute the command the same way.

I wanted to know if someone knows why with this difference of execution and how I can avoid that.
Because I can't manage to make work podman-compose

Creation of pod:
image

Inspection of a volume:
image

def run:
image

def output:
image

I changed this line: (line 362)
image
to this line:
image

And here is the 2 different output I had:
image

after the modification:
image

the error at the end is because of the format of the return

I use this version of Podman:
podman --version
C:\Users\tipaty\Downloads\podman-2.2.1\podman.exe version 2.2.1

I don't know how to check my version of podman-compose, but I know it's not devel, I just installed with pip install podman-compose (date: 6 of september 2021)

Thanks in advance for your help.

@muayyad-alsadi
Copy link
Collaborator

this might be due to having bash OR operator (||).
maybe your windows setup does not have bash or understand shell OR operator?

@muayyad-alsadi
Copy link
Collaborator

please make sure to use the devel

pip3 install https://github.com/containers/podman-compose/archive/devel.tar.gz

@ultymatom
Copy link
Author

Hello,

The bash operator is only in the log output, it's just something displayed with the print function, in the script they do a try with the inspect command, and if the return codes is not 0, it executes the create command

I try with the devel version and same problem. except that it happens even before because in the devel version it tries to do podman --version with the check_output at the begining of the script, so I've got the error also (but this stays the exact same problem)

I tried new things today.

I modify the function so that it executes "Powershell.exe C:/Users/tipaty/Downloads/podman-2.2.1/podman volume inspect swarm-stack_counter-vol"

I still have the same output on the python script, but if I execute it in cmd prompt I've got the message I'm supposed to have:
image

I know that in the profile of powershell I've got this executing:

& minikube -p minikube podman-env | Invoke-Expression
$env:Path += ";C:\Users\tipaty\Downloads\podman-2.2.1;;C:\Users\tipaty\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts"

When i play the command ""Powershell.exe C:/Users/tipaty/Downloads/podman-2.2.1/podman volume inspect swarm-stack_counter-vol" I can see it has been executed in cmd prompt and in the python script (I put a 60 sec spleep to check)

I know that if do not execute what is in the profile, podman remote do not work. So what I don't understand is that everything seems to wrk has it would but the result with subprocess.check_output is not the one expected.

I'm starting to be a bit lost :D

@ultymatom
Copy link
Author

ultymatom commented Sep 15, 2021

Hello, more news hoping that someone can help me.

the problem happens also on another computer so this does not seem to be an isolated issus.

And second, i discover that when I want to redirect the output of a podman command I have the same error:

image

(and the podman --version > C:\Users\tipaty\Downloads\podman-2.2.1_tmp\test ) did not write anythong in the file but it has emptied it)

@muayyad-alsadi
Copy link
Collaborator

so this is a problem of podman not podman-compose

@rhatdan it seems that podman gives an error when having its output redirected on windows.

@ultymatom
Copy link
Author

Yes, indeed it's a problem of podman, I also noticed that when I use Popen and add stdout=subprocess.PIPE in the arguments of the function (it allows to store the stdout) I also have the "handle is invalid error". I suppose that it needs to write somewhere the output and so we have the error (here I'm juste guessing)

@ultymatom
Copy link
Author

I checked on the podman github annd there is an issue about it has been corrected, se we need to wait for a next release
containers/podman#11444

So i close the issue here.

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

2 participants