diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/handlers/compat/images_push.go | 11 | ||||
-rw-r--r-- | pkg/specgen/generate/container.go | 10 |
2 files changed, 19 insertions, 2 deletions
diff --git a/pkg/api/handlers/compat/images_push.go b/pkg/api/handlers/compat/images_push.go index c352ac6cd..34b53f34e 100644 --- a/pkg/api/handlers/compat/images_push.go +++ b/pkg/api/handlers/compat/images_push.go @@ -1,7 +1,6 @@ package compat import ( - "context" "net/http" "strings" @@ -76,7 +75,15 @@ func PushImage(w http.ResponseWriter, r *http.Request) { if _, found := r.URL.Query()["tlsVerify"]; found { options.SkipTLSVerify = types.NewOptionalBool(!query.TLSVerify) } - if err := imageEngine.Push(context.Background(), imageName, query.Destination, options); err != nil { + + var destination string + if _, found := r.URL.Query()["destination"]; found { + destination = query.Destination + } else { + destination = imageName + } + + if err := imageEngine.Push(r.Context(), imageName, destination, options); err != nil { if errors.Cause(err) != storage.ErrImageUnknown { utils.ImageNotFound(w, imageName, errors.Wrapf(err, "failed to find image %s", imageName)) return diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go index 31d317bf8..f2af9dd5f 100644 --- a/pkg/specgen/generate/container.go +++ b/pkg/specgen/generate/container.go @@ -3,6 +3,7 @@ package generate import ( "context" "os" + "strings" "github.com/containers/image/v5/manifest" "github.com/containers/podman/v2/libpod" @@ -197,6 +198,15 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat annotations[ann.ContainerType] = ann.ContainerTypeContainer } + for _, v := range rtc.Containers.Annotations { + split := strings.SplitN(v, "=", 2) + k := split[0] + v := "" + if len(split) == 2 { + v = split[1] + } + annotations[k] = v + } // now pass in the values from client for k, v := range s.Annotations { annotations[k] = v |