-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 do not create working directory if it do not exist when using the Docker REST API #11842
Comments
Any chance you can provide the exact call Compose is making to create the container? |
That's not using Docker Compose, that's directly the agent using the API. But I can try to get a tcpdump with the data removed (making a reproducer shouldn't be too hard on test infra). Would the raw tcpdump file be fine ? |
Yes, that'd work fine |
Here is the dump (using socat + tcpdump). Wireshark open it without issue (on a recent one, eg, not the one on RHEL 7 like I tried first). The whole json should be inside, as well as answers. |
OK, I think the issue here is that the workdir is located on a volume. I recall merging a fix for this for Podman 3.4.0; any chance you can retest with that? |
Wait, I need to read more - you're already on 3.4.0. Damn. |
If Workdir is on a volume, it could be the chown change that matches the volume to the destdir rather then the user of the image. |
A friendly reminder that this issue had no activity for 30 days. |
Since I got no response to my idea, I am closing. If you want to respond and see if this is the problem then reopen. |
Why is the bug closed ? There was no sign of it being fixed, and and I gave all information. Should I repopen a bug and link that one ? |
@mscherer, can you please respond to rhatdan's comment. |
If you respond then we can continue the conversation. We have hundreds of issues, and when reporters do not responde for 30 days I close the issue. |
Well, I can answer, but I do not understand the question, as it seems not related to the problem from my perspective. The volume /drone is created by podman, as the API call do not have a src directory in argument, cf my 1st comment. From what I understand, that mean that podman will create it on the fly in /var/lib/containers/ The container is started with Workdir set to a subdirectory of that volume, who was just created empty by podman. On Docker/Moby, the engine create the subdirectory unconditionnaly (cf the link I gave). Forcing the configuration (c.config.CreateWorkingDir) on https://github.com/containers/podman/blob/main/libpod/container_internal_linux.go#L203 make it work. Since everything is done by podman, I am not sure exactly which chown the suggestion refer to, as there is 18 occurrences in the container_internal_linux.go file. I am not sure exactly what I should test in the first place, because it fail around line 208 and the nearest call to chown is around line 228. resolveWorkDir (from container_internal_linux.go ). Since the problem can be worked around by removing a check so podman match the behavior of docker/moby, I think the problem is not a permission issue, but a problem of API mismatch. |
In the compat API we should just force the CreateWorkingDir option. please open a PR for that. |
Done. So far, I tested by replacing podman on my personal CI, but I will also add it to ./python/docker/compat/ once I have a grasp of the current testing infra. |
Docker/Moby always create the working directory, and some tools rely on that behavior (example, woodpecker/drone). Fixes containers#11842 Signed-off-by: Michael Scherer <[email protected]>
Docker/Moby always create the working directory, and some tools rely on that behavior (example, woodpecker/drone). Fixes containers#11842 Signed-off-by: Michael Scherer <[email protected]> <MH: Fixed cherry-pick conflicts> Signed-off-by: Matthew Heon <[email protected]>
For various reason, /explorer is created with Docker, and not on podman (see containers/podman#11842) The easiest fix is to use a existing directory (rather than wrangling with podman/docker difference) And the current sourcecode need to be copied, which is not done by default as far as I know.
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
When using podman compatiblity layer (eg, the podman-docker rpm installed), woodpecker is unable to start a container, while it work fine with Docker.
Woodpecker is a go based CI system that do everything in a container. For now, it only support Docker, but I tried to test with Podman.
Steps to reproduce the issue:
deploy woodpecker-server and agent
install podman-docker
do a test build
Describe the results you received:
Upon doing a test build, woodpecker will create a container to do the git checkout, and that fail at that step with this error message in the log:
workdir "/drone/src/git.example.org/misc/blog" does not exist on container 56ed6ac93e0d828e90ea0bd1ca4cadad65d04a9afef200fa8bc0af9e880f8666
upon further debugging, this is the call to /v1.33/containers/0_5095234068184889173_clone_0/start that fail (error 500 + that error)
The container was created before with a call to /v1.33/containers/create with notably:
working dir set to "/drone/src/git.example.org/misc/blog"
the volume /drone mounted (json extract: "Volumes:{"/drone":{} }"
(I have the full json if needed)
Since /drone is a new volume, it will be empty. Since it will be empty, the subdirectory do not exist, so it fail.
Describe the results you expected:
I forced podman to create the workingdir with some creative editing around the code that print the error message on https://github.com/containers/podman/blob/main/libpod/container_internal_linux.go#L210 and it worked.
From a quick search, it seems moby create the working directory unconditionally:
https://github.com/moby/moby/blob/master/container/container.go#L266
Podman/libpod create only if a option (libpod.WithCreateWorkingDir) is passed when creating the container.
And while there is maybe some good reasons, I would expect the compat API to mirror docker/moby behavior.
Additional information you deem important (e.g. issue happens only occasionally):
This was first discussed on woodpecker-ci/woodpecker#85
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
F34 VM, on a RHEL 7 host.
The text was updated successfully, but these errors were encountered: