package idtools
import "github.com/docker/docker/pkg/idtools"
Index ¶
- func AddNamespaceRangesUser(name string) (int, int, error)
- func CreateIDMappings(username, groupname string) ([]IDMap, []IDMap, error)
- func GetRootUIDGID(uidMap, gidMap []IDMap) (int, int, error)
- func MkdirAllAs(path string, mode os.FileMode, ownerUID, ownerGID int) error
- func MkdirAllNewAs(path string, mode os.FileMode, ownerUID, ownerGID int) error
- func MkdirAs(path string, mode os.FileMode, ownerUID, ownerGID int) error
- func ToContainer(hostID int, idMap []IDMap) (int, error)
- func ToHost(contID int, idMap []IDMap) (int, error)
- type IDMap
Functions ¶
func AddNamespaceRangesUser ¶
AddNamespaceRangesUser takes a name and finds an unused uid, gid pair and calls the appropriate helper function to add the group and then the user to the group in /etc/group and /etc/passwd respectively.
func CreateIDMappings ¶
CreateIDMappings takes a requested user and group name and using the data from /etc/sub{uid,gid} ranges, creates the proper uid and gid remapping ranges for that user/group pair
func GetRootUIDGID ¶
GetRootUIDGID retrieves the remapped root uid/gid pair from the set of maps. If the maps are empty, then the root uid/gid will default to "real" 0/0
func MkdirAllAs ¶
MkdirAllAs creates a directory (include any along the path) and then modifies ownership to the requested uid/gid. If the directory already exists, this function will still change ownership to the requested uid/gid pair.
func MkdirAllNewAs ¶
MkdirAllNewAs creates a directory (include any along the path) and then modifies ownership ONLY of newly created directories to the requested uid/gid. If the directories along the path exist, no change of ownership will be performed
func MkdirAs ¶
MkdirAs creates a directory and then modifies ownership to the requested uid/gid. If the directory already exists, this function still changes ownership
func ToContainer ¶
ToContainer takes an id mapping, and uses it to translate a host ID to the remapped ID. If no map is provided, then the translation assumes a 1-to-1 mapping and returns the passed in id
func ToHost ¶
ToHost takes an id mapping and a remapped ID, and translates the ID to the mapped host ID. If no map is provided, then the translation assumes a 1-to-1 mapping and returns the passed in id #
Types ¶
type IDMap ¶
type IDMap struct { ContainerID int `json:"container_id"` HostID int `json:"host_id"` Size int `json:"size"` }
IDMap contains a single entry for user namespace range remapping. An array of IDMap entries represents the structure that will be provided to the Linux kernel for creating a user namespace.
Source Files ¶
idtools.go idtools_unix.go usergroupadd_unsupported.go
- Version
- v1.10.0-rc3
- Published
- Feb 2, 2016
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 44 minutes ago –
Tools for package owners.