mirror of
https://github.com/containers/podman.git
synced 2025-10-18 19:53:58 +08:00
Convert tmpfs mounts to use generate
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #19 Approved by: baude
This commit is contained in:

committed by
Atomic Bot

parent
402c30333f
commit
006a8bd6f3
@ -6,6 +6,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/daemon/caps"
|
"github.com/docker/docker/daemon/caps"
|
||||||
|
"github.com/docker/docker/pkg/mount"
|
||||||
spec "github.com/opencontainers/runtime-spec/specs-go"
|
spec "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/opencontainers/runtime-tools/generate"
|
"github.com/opencontainers/runtime-tools/generate"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@ -110,6 +111,19 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) {
|
|||||||
g.SetLinuxResourcesPidsLimit(config.resources.pidsLimit)
|
g.SetLinuxResourcesPidsLimit(config.resources.pidsLimit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, i := range config.tmpfs {
|
||||||
|
options := []string{"rw", "noexec", "nosuid", "nodev", "size=65536k"}
|
||||||
|
spliti := strings.SplitN(i, ":", 2)
|
||||||
|
if len(spliti) > 1 {
|
||||||
|
if _, _, err := mount.ParseTmpfsOptions(spliti[1]); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
options = strings.Split(spliti[1], ",")
|
||||||
|
}
|
||||||
|
// Default options if nothing passed
|
||||||
|
g.AddTmpfsMount(spliti[0], options)
|
||||||
|
}
|
||||||
|
|
||||||
configSpec := g.Spec()
|
configSpec := g.Spec()
|
||||||
|
|
||||||
if config.seccompProfilePath != "" && config.seccompProfilePath != "unconfined" {
|
if config.seccompProfilePath != "" && config.seccompProfilePath != "unconfined" {
|
||||||
@ -129,9 +143,6 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) {
|
|||||||
// BIND MOUNTS
|
// BIND MOUNTS
|
||||||
configSpec.Mounts = append(configSpec.Mounts, config.GetVolumeMounts()...)
|
configSpec.Mounts = append(configSpec.Mounts, config.GetVolumeMounts()...)
|
||||||
|
|
||||||
// TMPFS MOUNTS
|
|
||||||
configSpec.Mounts = append(configSpec.Mounts, config.GetTmpfsMounts()...)
|
|
||||||
|
|
||||||
// HANDLE CAPABILITIES
|
// HANDLE CAPABILITIES
|
||||||
if err := setupCapabilities(config, configSpec); err != nil {
|
if err := setupCapabilities(config, configSpec); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Reference in New Issue
Block a user