Any way to mount a device into the node's root filesystem from inside a running container?

I have a need to be able to mount a device on the bare metal root filesystem from inside a container. Or be able to run a command when a container exits.

Both bare metal OS and container are running Oracle Linux 7.x. Container can run in privileged mode and mount pretty much anything from the bare metal os.

We are using a container to provision storage on our storage nodes but need a way to mount some devices to the bare metal operating system from within a temporary container or after it exits somehow. (ie: if docker had some kind of exitpoint hook)

We do not want to do anything involving ssh for this. This is a totally isolated compute environment and the only entry/access point is the orchestration we use to run containers.

Thanks for any help.

Hi,

There are some really interesting discussions and options presented in various parts of the literature about pre- and post- hooks for containers. Here are a few I found interesting and useful. I certainly haven’t tried them all, so I can’t vouch for any particular option presented in these pages, but you may find them helpful. As you’ll see, Kubernetes has hooks for pods out of the box, and there are some suggestions about signal handlers for containers in the general case.

https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/