python-podman
python-podman copied to clipboard
BuildImage function in varlink api throws ' unable to open context dir tar file /path/to/context.tar ' error
Description:
BuildImage function in varlink api is throwing error ' unable to open context dir tar file /path/to/context.tar '.
Steps to reproduce:
- Created a docker file
- Created a python file to call build function with two parameters - dockerfile, imagetag
Below is the test code:
import podman
import os
with podman.Client() as client:
file="/dockerfile"
path=os.getcwd()+file
dockerfile=open(path,'+w');
print(client.images.build(dockerfile,'latest'))
Encountered below error on line client.images.build(dockerfile,'latest')
Traceback (most recent call last):
File "/root/.local/lib/python3.7/site-packages/podman/libs/images.py", line 131, in build
result = podman.BuildImage(config)
File "/root/.local/lib/python3.7/site-packages/varlink-30.1.2-py3.7.egg/varlink/client.py", line 86, in _wrapped
return self._call(method.name, *args, **kwargs)
File "/root/.local/lib/python3.7/site-packages/varlink-30.1.2-py3.7.egg/varlink/client.py", line 143, in _call
(message, more) = self._next_varlink_message()
File "/root/.local/lib/python3.7/site-packages/varlink-30.1.2-py3.7.egg/varlink/client.py", line 113, in _next_varlink_message
raise e
varlink.error.VarlinkError: {'parameters': {'reason': 'unable to open context dir tar file '}, 'error': 'io.podman.ErrorOccurred'}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "sdk1.py", line 8, in <module>
print(client.images.build(dockerfile,'latest'))
File "/root/.local/lib/python3.7/site-packages/podman/libs/images.py", line 131, in build
result = podman.BuildImage(config)
File "/root/.local/lib/python3.7/site-packages/podman/client.py", line 109, in __exit__
raise error_factory(e)
podman.libs.errors.ErrorOccurred: {'parameters': {'reason': 'unable to open context dir tar file '}, 'error': 'io.podman.ErrorOccurred'}
Jhon PTAL
@nehajain1809 patches are working their way from upstream. Once they land I'll close this bug.
This is still broken on Fedora 31.