github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/cmd/podman/platform_linux.go (about)

     1  // +build linux
     2  
     3  package main
     4  
     5  import (
     6  	"os"
     7  	"path/filepath"
     8  
     9  	"github.com/containers/libpod/pkg/rootless"
    10  	"github.com/sirupsen/logrus"
    11  )
    12  
    13  // userRegistriesFile is the path to the per user registry configuration file.
    14  var userRegistriesFile = filepath.Join(os.Getenv("HOME"), ".config/containers/registries.conf")
    15  
    16  func CheckForRegistries() {
    17  	if _, err := os.Stat("/etc/containers/registries.conf"); err != nil {
    18  		if os.IsNotExist(err) {
    19  			// If it is running in rootless mode, also check the user configuration file
    20  			if rootless.IsRootless() {
    21  				if _, err := os.Stat(userRegistriesFile); err != nil {
    22  					logrus.Warnf("unable to find %s. some podman (image shortnames) commands may be limited", userRegistriesFile)
    23  				}
    24  				return
    25  			}
    26  			logrus.Warn("unable to find /etc/containers/registries.conf. some podman (image shortnames) commands may be limited")
    27  		}
    28  	}
    29  }