python-podman icon indicating copy to clipboard operation
python-podman copied to clipboard

BuildImage function in varlink api throws ' unable to open context dir tar file /path/to/context.tar ' error

Open nehajain1809 opened this issue 6 years ago • 3 comments

Description:

BuildImage function in varlink api is throwing error ' unable to open context dir tar file /path/to/context.tar '.

Steps to reproduce:

  1. Created a docker file
  2. 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'}

nehajain1809 avatar Aug 13 '19 23:08 nehajain1809

Jhon PTAL

rhatdan avatar Aug 15 '19 10:08 rhatdan

@nehajain1809 patches are working their way from upstream. Once they land I'll close this bug.

jwhonce avatar Oct 28 '19 22:10 jwhonce

This is still broken on Fedora 31.

jonathanunderwood avatar Dec 26 '19 14:12 jonathanunderwood