mirror of
https://github.com/containers/podman.git
synced 2025-06-22 18:08:11 +08:00
Merge pull request #14344 from cdoern/podCreate
podman pod create --uidmap patch
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/containers/common/libnetwork/types"
|
"github.com/containers/common/libnetwork/types"
|
||||||
|
storageTypes "github.com/containers/storage/types"
|
||||||
spec "github.com/opencontainers/runtime-spec/specs-go"
|
spec "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -222,6 +223,10 @@ type PodResourceConfig struct {
|
|||||||
|
|
||||||
type PodSecurityConfig struct {
|
type PodSecurityConfig struct {
|
||||||
SecurityOpt []string `json:"security_opt,omitempty"`
|
SecurityOpt []string `json:"security_opt,omitempty"`
|
||||||
|
// IDMappings are UID and GID mappings that will be used by user
|
||||||
|
// namespaces.
|
||||||
|
// Required if UserNS is private.
|
||||||
|
IDMappings *storageTypes.IDMappingOptions `json:"idmappings,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPodSpecGenerator creates a new pod spec
|
// NewPodSpecGenerator creates a new pod spec
|
||||||
|
@ -38,10 +38,12 @@ function _require_crun() {
|
|||||||
|
|
||||||
@test "rootful pod with custom ID mapping" {
|
@test "rootful pod with custom ID mapping" {
|
||||||
skip_if_rootless "does not work rootless - rootful feature"
|
skip_if_rootless "does not work rootless - rootful feature"
|
||||||
skip_if_remote "remote --uidmap is broken (see #14233)"
|
|
||||||
random_pod_name=$(random_string 30)
|
random_pod_name=$(random_string 30)
|
||||||
run_podman pod create --uidmap 0:200000:5000 --name=$random_pod_name
|
run_podman pod create --uidmap 0:200000:5000 --name=$random_pod_name
|
||||||
run_podman pod start $random_pod_name
|
run_podman pod start $random_pod_name
|
||||||
|
run_podman pod inspect --format '{{.InfraContainerID}}' $random_pod_name
|
||||||
|
run podman inspect --format '{{.HostConfig.IDMappings.UIDMap}}' $output
|
||||||
|
is "$output" ".*0:200000:5000" "UID Map Successful"
|
||||||
|
|
||||||
# Remove the pod and the pause image
|
# Remove the pod and the pause image
|
||||||
run_podman pod rm $random_pod_name
|
run_podman pod rm $random_pod_name
|
||||||
|
Reference in New Issue
Block a user