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

No such file or directory error when building image #177

Open
k-yarovoy-samsung opened this issue May 18, 2022 · 2 comments
Open

No such file or directory error when building image #177

k-yarovoy-samsung opened this issue May 18, 2022 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@k-yarovoy-samsung
Copy link

Have met a problem during building an image through podman-py:

File "/usr/local/lib/python3.8/site-packages/podman/domain/images_build.py", line 89, in build
    params["dockerfile"] = api.prepare_containerfile(kwargs["path"], params["dockerfile"])

File "/usr/local/lib/python3.8/site-packages/podman/api/tar_utils.py", line 50, in prepare_containerfile
    shutil.copy2(dockerfile_path, proxy_path, follow_symlinks=False)

File "/usr/lib64/python3.8/shutil.py", line 435, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)

File "/usr/lib64/python3.8/shutil.py", line 264, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:

FileNotFoundError: [Errno 2] No such file or directory: '.containerfile.7482d90f40a649bde91353e5326d5a698053219c'

It appears if path parameter for images.build is set, but dockerfile isn't.

Looked a bit into podman-py code and found probable cause of this issue in podman-py/podman/api/tar_utils/prepare_containerfile:

proxy_path = anchor_path / f".containerfile.{random.getrandbits(160):x}"
shutil.copy2(dockerfile_path, proxy_path, follow_symlinks=False)
return proxy_path.name

It seems, that between creating path and copying - there should be creation of temporary file.

@artificial-intelligence

did anybody have a look at this?

@rhatdan
Copy link
Member

rhatdan commented Sep 18, 2023

@floutok PTAL

@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