package idtools
import "github.com/dotcloud/docker/pkg/idtools"
Index ¶
- func GetRootUIDGID(uidMap, gidMap []IDMap) (int, int, error)
- func MkdirAllAndChown(path string, mode os.FileMode, owner Identity) error
- func MkdirAllAndChownNew(path string, mode os.FileMode, owner Identity) error
- func MkdirAndChown(path string, mode os.FileMode, owner Identity) error
- func ToUserIdentityMapping(u IdentityMapping) user.IdentityMapping
- type IDMap
- type Identity
- type IdentityMapping
Functions ¶
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
Deprecated: use [(user.IdentityMapping).RootPair] instead.
func MkdirAllAndChown ¶
MkdirAllAndChown 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 and permissions.
Deprecated: use user.MkdirAllAndChown instead.
func MkdirAllAndChownNew ¶
MkdirAllAndChownNew 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 or permissions will be performed
Deprecated: use user.MkdirAllAndChown with the user.WithOnlyNew option instead.
func MkdirAndChown ¶
MkdirAndChown creates a directory and then modifies ownership to the requested uid/gid. If the directory already exists, this function still changes ownership and permissions. Note that unlike os.Mkdir(), this function does not return IsExist error in case path already exists.
Deprecated: use user.MkdirAndChown instead.
func ToUserIdentityMapping ¶
func ToUserIdentityMapping(u IdentityMapping) user.IdentityMapping
ToUserIdentityMapping converts an idtools.IdentityMapping to a user.IdentityMapping.
Deprecated: use user.IdentityMapping directly, this is transitioning to user package.
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.
Deprecated: use user.IDMap instead.
type Identity ¶
Identity is either a UID and GID pair or a SID (but not both)
func CurrentIdentity ¶
func CurrentIdentity() Identity
CurrentIdentity returns the identity of the current process
Deprecated: use os.Getuid and os.Getegid instead.
func (Identity) Chown ¶
Chown changes the numeric uid and gid of the named file to id.UID and id.GID.
type IdentityMapping ¶
IdentityMapping contains a mappings of UIDs and GIDs. The zero value represents an empty mapping.
func FromUserIdentityMapping ¶
func FromUserIdentityMapping(u user.IdentityMapping) IdentityMapping
FromUserIdentityMapping converts a user.IdentityMapping to an idtools.IdentityMapping.
Deprecated: use user.IdentityMapping directly, this is transitioning to user package.
func (IdentityMapping) Empty ¶
func (i IdentityMapping) Empty() bool
Empty returns true if there are no id mappings
func (IdentityMapping) RootPair ¶
func (i IdentityMapping) RootPair() Identity
RootPair returns a uid and gid pair for the root user. The error is ignored because a root user always exists, and the defaults are correct when the uid and gid maps are empty.
func (IdentityMapping) ToContainer ¶
func (i IdentityMapping) ToContainer(pair Identity) (int, int, error)
ToContainer returns the container UID and GID for the host uid and gid
func (IdentityMapping) ToHost ¶
func (i IdentityMapping) ToHost(pair Identity) (Identity, error)
ToHost returns the host UID and GID for the container uid, gid. Remapping is only performed if the ids aren't already the remapped root ids
Source Files ¶
- Version
- v28.1.1+incompatible (latest)
- Published
- Apr 18, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 1 day ago –
Tools for package owners.