mirror of
https://github.com/containers/podman.git
synced 2025-11-03 07:47:19 +08:00
Set default storage from containers.conf for temporary images
Fixes: https://github.com/containers/podman/issues/11107 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
28
vendor/github.com/containers/common/pkg/config/config.go
generated
vendored
28
vendor/github.com/containers/common/pkg/config/config.go
generated
vendored
@ -234,6 +234,9 @@ type EngineConfig struct {
|
||||
// EventsLogger determines where events should be logged.
|
||||
EventsLogger string `toml:"events_logger,omitempty"`
|
||||
|
||||
// graphRoot internal stores the location of the graphroot
|
||||
graphRoot string
|
||||
|
||||
// HelperBinariesDir is a list of directories which are used to search for
|
||||
// helper binaries.
|
||||
HelperBinariesDir []string `toml:"helper_binaries_dir"`
|
||||
@ -384,6 +387,12 @@ type EngineConfig struct {
|
||||
// before sending kill signal.
|
||||
StopTimeout uint `toml:"stop_timeout,omitempty"`
|
||||
|
||||
// ImageCopyTmpDir is the default location for storing temporary
|
||||
// container image content, Can be overridden with the TMPDIR
|
||||
// environment variable. If you specify "storage", then the
|
||||
// location of the container/storage tmp directory will be used.
|
||||
ImageCopyTmpDir string `toml:"image_copy_tmp_dir,omitempty"`
|
||||
|
||||
// TmpDir is the path to a temporary directory to store per-boot container
|
||||
// files. Must be stored in a tmpfs.
|
||||
TmpDir string `toml:"tmp_dir,omitempty"`
|
||||
@ -1148,3 +1157,22 @@ func (c *Config) FindHelperBinary(name string, searchPATH bool) (string, error)
|
||||
}
|
||||
return "", errors.Errorf("could not find %q in one of %v", name, c.Engine.HelperBinariesDir)
|
||||
}
|
||||
|
||||
// ImageCopyTmpDir default directory to store tempory image files during copy
|
||||
func (c *Config) ImageCopyTmpDir() (string, error) {
|
||||
if path, found := os.LookupEnv("TMPDIR"); found {
|
||||
return path, nil
|
||||
}
|
||||
switch c.Engine.ImageCopyTmpDir {
|
||||
case "":
|
||||
return "", nil
|
||||
case "storage":
|
||||
return filepath.Join(c.Engine.graphRoot, "tmp"), nil
|
||||
default:
|
||||
if filepath.IsAbs(c.Engine.ImageCopyTmpDir) {
|
||||
return c.Engine.ImageCopyTmpDir, nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", errors.Errorf("invalid image_copy_tmp_dir value %q (relative paths are not accepted)", c.Engine.ImageCopyTmpDir)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user