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

podman-remote cannot send tar content with correct dockerfile #8374

Closed
kazimsarikaya opened this issue Nov 17, 2020 · 8 comments
Closed

podman-remote cannot send tar content with correct dockerfile #8374

kazimsarikaya opened this issue Nov 17, 2020 · 8 comments
Assignees
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@kazimsarikaya
Copy link
Contributor

Hello,
There is a two bug while sending tar to remote with podman-remote.

First one is at: https://github.com/containers/podman/blob/master/pkg/bindings/images/build.go#L143

params.Set("dockerfile", filepath.Base(containerFiles[0]))

docker file can be at anywhere so I don't think we set dockerfile parameter as only the file name.

The second one is at: https://github.com/containers/podman/blob/master/pkg/bindings/images/build.go#L219

if !info.Mode().IsRegular() || path == s {

sources[0] is dockerfile and path==s always will be true. hence dockerfile will not be added to tar.

I use my own fork with tar compression with gzip and dockerignore parsing at https://github.com/kazimsarikaya/podman/tree/fix-send-tar

I didn't create any push request however because I use additional gzip and dockerignore enhancements.

@zhangguanzhang
Copy link
Collaborator

could you show the steps to reproduce it?

@kazimsarikaya
Copy link
Contributor Author

I started a podman system on a linux machine with:

/usr/local/bin/podman system service --time=0 tcp:192.168.99.114:1928

on osx machine I send a build request with:

declare -x CONTAINER_HOST="tcp://192.168.99.114:1928"
podman-remote  build -f docker/test.Dockerfile --platform linux/amd64  . 

And after sending context, the returned result is about not finding test.Dockerfile. Dockerfile path is changed. It should be docker/test.Dockerfile. The line

params.Set("dockerfile", filepath.Base(containerFiles[0]))

removes directroy name. Probably the aim is always sending dockerfile if it is also removed by .dockerignore.

And also I reading/testing the code, nTar functions parameter sources contains docker file at index 0. for loop's first try with filepath.Walk, the line

if !info.Mode().IsRegular() || path == s {

always returns true. because path and s is both the dockerfile. I found it when I implement .dockerignore when sending context as tar file.

The problem occurs when dockerfiles are inside subdirectories.

@zhangguanzhang
Copy link
Collaborator

kazimsarikaya@6565264
@rhatdan PTAL

@rhatdan
Copy link
Member

rhatdan commented Nov 23, 2020

@zhangguanzhang Are you opening a PR?

@kazimsarikaya
Copy link
Contributor Author

I open an pr.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@kazimsarikaya
Copy link
Contributor Author

I am still working on the pr #8456

@rhatdan rhatdan assigned kazimsarikaya and unassigned jwhonce Dec 26, 2020
@rhatdan rhatdan added the In Progress This issue is actively being worked by the assignee, please do not work on this at this time. label Dec 26, 2020
@kazimsarikaya
Copy link
Contributor Author

#8456 merged.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

4 participants