diff options
author | Matthew Heon <matthew.heon@pm.me> | 2020-05-05 16:19:30 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-05-05 20:21:01 -0400 |
commit | f7c3cfde77a4bc8b241fb36c4d39cbe2fde0c45c (patch) | |
tree | 1955cdfcb7ef8705944bcb1b0f8b42286863224e /pkg/specgen | |
parent | fb6eca50ba9e2dc652da0c33c72db70ab9da85e9 (diff) | |
download | podman-f7c3cfde77a4bc8b241fb36c4d39cbe2fde0c45c.tar.gz podman-f7c3cfde77a4bc8b241fb36c4d39cbe2fde0c45c.tar.bz2 podman-f7c3cfde77a4bc8b241fb36c4d39cbe2fde0c45c.zip |
Add small fixes for 'podman run' from diffing inspect
To try and identify differences between Podman v1.9 and master,
I ran a series of `podman run` commands with various flags
through each, then inspecting the resulting containers and diffed
the inspect JSON between each. This identified a number of issues
which are fixed in this PR.
In order of discovery:
- Podman v2 gave short names for images, where Podman v1 gave the
fully-qualified name. Simple enough fix (get image tags and use
the first one if they're available)
- The --restart flag was not being parsed correctly when a number
of retries was specified. Parsing has been corrected.
- The -m flag was not setting the swap limit (simple fix to set
swap in that case if it's not explicitly set by the user)
- The --cpus flag was completely nonfunctional (wired in its
logic)
Tests have been added for all of these to catch future
regressions.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/container_create.go | 7 | ||||
-rw-r--r-- | pkg/specgen/specgen.go | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index be54b60d2..f3aaf96bf 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -85,7 +85,12 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener if err != nil { return nil, err } - options = append(options, libpod.WithRootFSFromImage(newImage.ID(), s.Image, s.RawImageName)) + imgName := s.Image + names := newImage.Names() + if len(names) > 0 { + imgName = names[0] + } + options = append(options, libpod.WithRootFSFromImage(newImage.ID(), imgName, s.Image)) } if err := s.Validate(); err != nil { return nil, errors.Wrap(err, "invalid config provided") diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go index 4f1c4fde1..4ad6dd6fb 100644 --- a/pkg/specgen/specgen.go +++ b/pkg/specgen/specgen.go @@ -140,10 +140,6 @@ type ContainerStorageConfig struct { // Conflicts with Rootfs. // At least one of Image or Rootfs must be specified. Image string `json:"image"` - // RawImageName is the unprocessed and not-normalized user-specified image - // name. One use case for having this data at hand are auto-updates where - // the _exact_ user input is needed in order to look-up the correct image. - RawImageName string `json:"raw_image_name,omitempty"` // Rootfs is the path to a directory that will be used as the // container's root filesystem. No modification will be made to the // directory, it will be directly mounted into the container as root. |