-
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
Optionally skip the built-in bind mounts (eg., /etc/resolv.conf) #2744
Comments
Would it be sufficient to bind-mount the symlinks in at container creation time? The mounts will be automatically superseded if you specify something else to mount in its place. |
Yes we will not use the builtins if there is a bind mount from the host. I think it will be fine as long as the INODES from the host stay the same. IE The file content gets modified as opposed to mv the file asside and replace it with a new file. |
To confirm here, it looks like we do traverse the links before bind-mounting in, so a rename/remove would probably break this - we'd always point to the old file. |
Umm... I don't understand. First, I am trying to mess with the image to set up
But that doesn't work. I don't know why. If that had worked, I'd have set |
We are talking about |
I would expect Aside - I suspect you run into the exact same problems I was describing if you mount another resolv.conf into |
Confirmed on root, too - we can't delete, rename, etc |
Umm... but isn't that roughly what |
Does that mean that we also need to stop Buildah from creating the bind mount for it's working containers? |
I think we'd like to maintain the symlink-to-mounted directory setup if possible, rather than putting constraints on how things are updated. Either with an option to skip, or an option to "mount" a symlink within the container filesystem. Allowing this also allows a simple version: --volume /etc:/run/host/etc (leaks more host information to the container then the flatpak watcher approach, but might be useful depending on the use case.) |
Podman by default copies the resolv.conf into the container private data and then allows the container to manage it. |
@owtaylor we could do that but we would then need the flag to say no builtin network mounts? |
If there was a flag to make a symlink that overrode the builtin mounts, then there wouldn't need to be a separate flag to skip the builtin mounts. |
@owtaylor I see Any other files you were looking at here? |
I actually like --dns=none. |
May be a quick meeting to discuss requirements for this. |
To be clear, this isn't just convenience - you can't make the symlink in the image currently because the builtin default mounts overwrite it. The complete set of files we are looking at at the moment is: /etc/localtime |
Yes, |
@owtaylor Of those, we only manage |
We have merged in --dns=none for this issue. |
/kind feature
Description
Currently
podman start
bind mounts a built-in list of standard files from the host into the container. While those are definitely good defaults, it's sometimes desirable to skip some of them. For example,/etc/resolv.conf
can change on the host due to changes in the network - moving from one wireless access point to another, etc.. When that happens, and the host OS updates its/etc/resolv.conf
via an atomic rename, the changes aren't propagated into the container's bind mounted copy because the original is now a separate file with a different inode.This is an important use-case for the Silverblue toolbox.
Flatpak containers solve this by having
/etc/resolv.conf
be a symbolic link to/run/host/monitor/resolv.conf
, where/run/host/monitor
is a bind mount from the host that contains updated copies of/etc/resolv.conf
and friends. The host usually has the copies in$XDG_RUNTIME_DIR/.flatpak-helper/monitor
and they are kept updated by a small D-Bus session service usinginotify
watches.The toolbox can use the same mechanism by waking up the D-Bus session service [1], and setting up the necessary bind mounts and symbolic links.
However, currently, the built-in bind mount gets in the way. One has to
podman exec
into the started container and undo the mounts. This works but seems racy or needlessly repetitive to me. In theorytoolbox enter
can be invoked in parallel from two interactive shells, andpodman start
exits with the same code regardless of whether the container was already running or was actually started. So everytoolbox enter
invocation will end up doing this again and again.Instead, if
podman start
could be told to skip some of the built-in mounts, then the symbolic links could be created in the image duringtoolbox create
and the toolbox start-up could remain simple.It appears simple to implement this by wiring an option of some sort from
podman start
tomakeBindMounts
. However, I don't know how it should look. It could be useful if the option could be easily extended to skip any of the other mounts too. So maybe something like--skip-bind-mount=<path>
that can be specified multiple times?[1]
gdbus call --session --dest org.freedesktop.Flatpak --object-path /org/freedesktop/Flatpak/SessionHelper --method org.freedesktop.Flatpak.SessionHelper.RequestSession
The text was updated successfully, but these errors were encountered: