summaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 95db85b70..648dc821e 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -710,6 +710,35 @@ func (c *Container) Routes() ([]types.Route, error) {
return routes, nil
}
+// BindMounts retrieves bind mounts that were created by libpod and will be
+// added to the container
+// All these mounts except /dev/shm are ignored if a mount in the given spec has
+// the same destination
+// These mounts include /etc/resolv.conf, /etc/hosts, and /etc/hostname
+// The return is formatted as a map from destination (mountpoint in the
+// container) to source (path of the file that will be mounted into the
+// container)
+// If the container has not been started yet, an empty map will be returned, as
+// the files in question are only created when the container is started.
+func (c *Container) BindMounts() (map[string]string, error) {
+ if !c.locked {
+ c.lock.Lock()
+ defer c.lock.Unlock()
+
+ if err := c.syncContainer(); err != nil {
+ return nil, err
+ }
+ }
+
+ newMap := make(map[string]string, len(c.state.BindMounts))
+
+ for key, val := range c.state.BindMounts {
+ newMap[key] = val
+ }
+
+ return newMap, nil
+}
+
// Misc Accessors
// Most will require locking