generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 23
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
fix: resolve podman compatibility issues #512
Merged
Merged
Conversation
This file contains 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
oracle-contributor-agreement
bot
added
the
OCA Verified
All contributors have signed the Oracle Contributor Agreement.
label
Oct 12, 2023
nathanwn
force-pushed
the
resolve-podman-compatibility-issues
branch
from
October 12, 2023 07:00
e515cf6
to
1d91712
Compare
nathanwn
changed the title
fix: resolve podman compatibility issues
fix: improve run_macaron.sh and resolve podman compatibility issues
Oct 18, 2023
nathanwn
force-pushed
the
resolve-podman-compatibility-issues
branch
from
October 18, 2023 03:24
8cf42f8
to
5389861
Compare
nathanwn
changed the title
fix: improve run_macaron.sh and resolve podman compatibility issues
fix: resolve podman compatibility issues
Oct 19, 2023
nathanwn
force-pushed
the
resolve-podman-compatibility-issues
branch
7 times, most recently
from
October 25, 2023 02:05
9208555
to
18732f2
Compare
nathanwn
force-pushed
the
resolve-podman-compatibility-issues
branch
from
October 25, 2023 03:49
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]>
nathanwn
force-pushed
the
resolve-podman-compatibility-issues
branch
from
October 25, 2023 23:53
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. | ||
# |
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.sh
script 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
root
both 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 run
maps the host user$UID
to a user with the same$UID
in the container.podman run
maps the host user$UID
to theroot
user 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_USERNS
tokeep-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/d
directory on host beforehand):Mount option
:Z
At the moment, when the Macaron container starts up, the UID of the user
macaron
in the container gets changed to match the UID of the user on the host. This is done with theusermod
command. Consequently, the owner UID of the/home/macaron
directory 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/macaron
in the container without the:Z
option.Here is how to reproduce.
Dockerfile
.localhost/foobar
:$ podman build . -t localhost/foobar
d
in the current working directory and mount it into the container.$ podman run --rm -ti -v $PWD/d:/home/macaron/d localhost/foobar bash
docker run
again, this time with the:Z
mount option. Theusermod
error should be gone.Solution: For all volume mounts under
/home/macaron
, we need to provide the:Z
mount option to tell Podman that the volume is not shared with any other container, and thus modifying the owner of/home/macaron
is safe.