summaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-04-23 20:42:53 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-04 17:15:55 +0000
commitb51d7379987581da82902027fe91cdf298047bc0 (patch)
treef9d7fbebf3b946caea5eb5e2c626a19413c795c8 /libpod/container.go
parent1f5debd43806cc3bd07f562ff00ef4c426540f98 (diff)
downloadpodman-b51d7379987581da82902027fe91cdf298047bc0.tar.gz
podman-b51d7379987581da82902027fe91cdf298047bc0.tar.bz2
podman-b51d7379987581da82902027fe91cdf298047bc0.zip
Begin wiring in USERNS Support into podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #690 Approved by: mheon
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go28
1 files changed, 27 insertions, 1 deletions
diff --git a/libpod/container.go b/libpod/container.go
index e7fe77498..fb1f83c29 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -173,7 +173,8 @@ type ContainerConfig struct {
// TODO consider breaking these subsections up into smaller structs
- // Storage Config
+ // UID/GID mappings used by the storage
+ IDMappings storage.IDMappingOptions `json:"idMappingsOptions,omitempty"`
// Information on the image used for the root filesystem/
RootfsImageID string `json:"rootfsImageID,omitempty"`
@@ -863,3 +864,28 @@ func (c *Container) RWSize() (int64, error) {
}
return c.rwSize()
}
+
+// IDMappings returns the UID/GID mapping used for the container
+func (c *Container) IDMappings() (storage.IDMappingOptions, error) {
+ return c.config.IDMappings, nil
+}
+
+// RootUID returns the root user mapping from container
+func (c *Container) RootUID() int {
+ for _, uidmap := range c.config.IDMappings.UIDMap {
+ if uidmap.ContainerID == 0 {
+ return uidmap.HostID
+ }
+ }
+ return 0
+}
+
+// RootGID returns the root user mapping from container
+func (c *Container) RootGID() int {
+ for _, gidmap := range c.config.IDMappings.GIDMap {
+ if gidmap.ContainerID == 0 {
+ return gidmap.HostID
+ }
+ }
+ return 0
+}