-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
A different behavior about non-root user's volume mount #3432
Comments
@mheon Was this fixed in your rework on volumes? Potentially fixed in 1.4.2? |
This one is a bug in that rework, actually - fixed in 1.3.2 (plus 1.4.0 and later). |
Thanks for the checking.
In case of the docker
|
Try with --userns=keep-id
Rootless containers map the UID of the user that ran the container to root
without it.
…On Wed, Jun 26, 2019, 09:58 Jun Aruga ***@***.***> wrote:
Thanks for the checking.
In the podman 1.4.2, there is no error.
But the file's owner and group is "root". It needs to be "jaruga". That is
different from docker.
Can you reopen?
$ podman version
Version: 1.4.2
RemoteAPI Version: 1
Go Version: go1.12.5
OS/Arch: linux/amd64
$ ls -l Dockerfile
-rw-rw-r-- 1 jaruga jaruga 314 Jun 25 21:19 Dockerfile
$ podman build --rm \
--build-arg USER_NAME=$(id -un) \
--build-arg USER_ID=$(id -u) \
--build-arg GROUP_NAME=$(id -gn) \
--build-arg GROUP_ID=$(id -g) \
-t sample .
$ podman run --rm -t -v $(pwd):/work -w /work -u "$(id -un)" sample ls -l
total 4
-rw-rw-r-- 1 root root 314 Jun 25 19:19 Dockerfile
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3432>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB3AOCFCJTXAL35H3H2WXNLP4NYZZANCNFSM4H3LWSJA>
.
|
@mairin thanks for the info. It works with "--userns=keep-id"! the option is podman specific feature right?
|
Yes, since Docker does not use the User Namespace it does not support the field. |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
I am not sure if this is a bug.
There is a different behavior to use
podman -v HOST_DIR:CONTAINER_DIR
for createdVOLUME
inDockerfile
betweenpodman
anddocker
.This is important use case for me because the use case is used to run a source code in container with same user on host such as running mounted unit tests in the container.
If the root user runs the unit test in container, the host's mounting directory is updated by root user. That's not good.
The
Dockerfile
and steps I showed are not a minimal reproducer. I wanted to show actual use case to use non-root user's files in a volume mount directory.Thank you.
Steps to reproduce the issue:
Describe the results you received:
Describe the results you expected:
The command outputs "non-root user"'s file in the volume directory.
Additional information you deem important (e.g. issue happens only occasionally):
In case of docker as a comparison
In case of podman with "--image-volume=tmpfs"
The command shows "root user"'s file in the volume directory.
This is not what I intent. I referred #3174 (comment) .
Output of
podman version
:Output of
podman info --debug
:Additional environment details (AWS, VirtualBox, physical, etc.):
My local laptop Fedora 30.
The text was updated successfully, but these errors were encountered: