Merge pull request from vrothberg/fix-7407

run/create: record raw image
This commit is contained in:
OpenShift Merge Robot
2020-09-16 09:00:47 +02:00
committed by GitHub
5 changed files with 12 additions and 2 deletions
cmd/podman/containers
pkg/specgen
test/system

@ -110,7 +110,9 @@ func create(cmd *cobra.Command, args []string) error {
} }
imageName := args[0] imageName := args[0]
rawImageName := ""
if !cliVals.RootFS { if !cliVals.RootFS {
rawImageName = args[0]
name, err := pullImage(args[0]) name, err := pullImage(args[0])
if err != nil { if err != nil {
return err return err
@ -121,6 +123,7 @@ func create(cmd *cobra.Command, args []string) error {
if err := common.FillOutSpecGen(s, &cliVals, args); err != nil { if err := common.FillOutSpecGen(s, &cliVals, args); err != nil {
return err return err
} }
s.RawImageName = rawImageName
if _, err := createPodIfNecessary(s, cliVals.Net); err != nil { if _, err := createPodIfNecessary(s, cliVals.Net); err != nil {
return err return err

@ -130,7 +130,9 @@ func run(cmd *cobra.Command, args []string) error {
} }
imageName := args[0] imageName := args[0]
rawImageName := ""
if !cliVals.RootFS { if !cliVals.RootFS {
rawImageName = args[0]
name, err := pullImage(args[0]) name, err := pullImage(args[0])
if err != nil { if err != nil {
return err return err
@ -177,6 +179,7 @@ func run(cmd *cobra.Command, args []string) error {
if err := common.FillOutSpecGen(s, &cliVals, args); err != nil { if err := common.FillOutSpecGen(s, &cliVals, args); err != nil {
return err return err
} }
s.RawImageName = rawImageName
runOpts.Spec = s runOpts.Spec = s
if _, err := createPodIfNecessary(s, cliVals.Net); err != nil { if _, err := createPodIfNecessary(s, cliVals.Net); err != nil {

@ -95,7 +95,7 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener
if len(names) > 0 { if len(names) > 0 {
imgName = names[0] imgName = names[0]
} }
options = append(options, libpod.WithRootFSFromImage(newImage.ID(), imgName, s.Image)) options = append(options, libpod.WithRootFSFromImage(newImage.ID(), imgName, s.RawImageName))
} }
if err := s.Validate(); err != nil { if err := s.Validate(); err != nil {
return nil, errors.Wrap(err, "invalid config provided") return nil, errors.Wrap(err, "invalid config provided")

@ -89,6 +89,9 @@ type ContainerBasicConfig struct {
// If not given, a default location will be used. // If not given, a default location will be used.
// Optional. // Optional.
ConmonPidFile string `json:"conmon_pid_file,omitempty"` ConmonPidFile string `json:"conmon_pid_file,omitempty"`
// RawImageName is the user-specified and unprocessed input referring
// to a local or a remote image.
RawImageName string `json:"raw_image_name,omitempty"`
// RestartPolicy is the container's restart policy - an action which // RestartPolicy is the container's restart policy - an action which
// will be taken when the container exits. // will be taken when the container exits.
// If not given, the default policy, which does nothing, will be used. // If not given, the default policy, which does nothing, will be used.

@ -41,7 +41,8 @@ function teardown() {
fi fi
cname=$(random_string) cname=$(random_string)
run_podman create --name $cname --label "io.containers.autoupdate=image" --detach $IMAGE top # See #7407 for --pull=always.
run_podman create --pull=always --name $cname --label "io.containers.autoupdate=image" --detach $IMAGE top
run_podman generate systemd --new $cname run_podman generate systemd --new $cname
echo "$output" > "$UNIT_FILE" echo "$output" > "$UNIT_FILE"