generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 30
fix: resolve podman compatibility issues #512
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e515cf6 to
1d91712
Compare
8cf42f8 to
5389861
Compare
9208555 to
18732f2
Compare
18732f2 to
8033065
Compare
tromai
approved these changes
Oct 25, 2023
Signed-off-by: Nathan Nguyen <[email protected]>
Signed-off-by: Nathan Nguyen <[email protected]>
Signed-off-by: Nathan Nguyen <[email protected]>
1f00686 to
6148c94
Compare
behnazh-w
reviewed
Oct 31, 2023
| } | ||
|
|
||
| # Add a directory to the list of volume mounts stored in the ``mounts`` global variable. | ||
| # |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to rename the function to indicate that it can potentially create a directory.
In addition, please add a note here that this function can have side effect, i.e., if the mounted directory does not exist, it will create it.
… creation behavior Signed-off-by: Nathan Nguyen <[email protected]>
behnazh-w
approved these changes
Nov 1, 2023
art1f1c3R
pushed a commit
that referenced
this pull request
Nov 29, 2024
Signed-off-by: Nathan Nguyen <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for Podman as an alternative container engine to run the Macaron image.
The current
run_macaron.shscript is not fully compatible with Podman, due to known cases where Docker and Podman behave differently. Changes in this PR address these cases.Volume-mounting non-existing directories on host
Podman completely bans volume-mounting non-existing directories on the host into the container. See containers/podman#6234 for more details.
Meanwhile, mounting a non-existing directory on the host into a container is allowed in Docker. There is a peculiar behavior: the non-existing directory is owned by
rootboth inside and outside the container.Solution: Before volume-mounting a directory, we can either (1) create that directory if it does not exist, or (2) error. The choice should be consistent with how the Macaron Python package behaves.
UID mapping and Volume mount owner
By default
docker runmaps the host user$UIDto a user with the same$UIDin the container.podman runmaps the host user$UIDto therootuser in the container.Solution: To make sure Podman behaves exactly like docker w.r.t. volume mount owner, we can set the environment variable
PODMAN_USERNStokeep-id. For more details, see https://docs.podman.io/en/v4.4/markdown/options/userns.container.html#userns-mode.Example (Note that in the following example, you must create the
$PWD/ddirectory on host beforehand):Mount option
:ZAt the moment, when the Macaron container starts up, the UID of the user
macaronin the container gets changed to match the UID of the user on the host. This is done with theusermodcommand. Consequently, the owner UID of the/home/macarondirectory in the container gets changed.There has not been any issue with Docker so far. However, Podman errors in cases where we mount any volume under
/home/macaronin the container without the:Zoption.Here is how to reproduce.
Dockerfile.localhost/foobar:$ podman build . -t localhost/foobardin the current working directory and mount it into the container.$ podman run --rm -ti -v $PWD/d:/home/macaron/d localhost/foobar bashdocker runagain, this time with the:Zmount option. Theusermoderror should be gone.Solution: For all volume mounts under
/home/macaron, we need to provide the:Zmount option to tell Podman that the volume is not shared with any other container, and thus modifying the owner of/home/macaronis safe.