diff options
author | Aditya R <arajan@redhat.com> | 2022-02-22 22:10:34 +0530 |
---|---|---|
committer | Aditya R <arajan@redhat.com> | 2022-02-23 17:38:28 +0530 |
commit | fbbcb957c710ab817c969a8dc3ff3c46619604e2 (patch) | |
tree | 33971ff9377ee3cbf455ebe4c915722d3c3438bc /pkg/api/handlers | |
parent | 0cfb5d7e75507783e463e0df645e873e5a77bbfa (diff) | |
download | podman-fbbcb957c710ab817c969a8dc3ff3c46619604e2.tar.gz podman-fbbcb957c710ab817c969a8dc3ff3c46619604e2.tar.bz2 podman-fbbcb957c710ab817c969a8dc3ff3c46619604e2.zip |
container-commit: support --squash to squash layers into one
Allow users to commit containers into a single layer.
Usage
```bash
podman container commit --squash <name>
```
Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r-- | pkg/api/handlers/compat/images.go | 2 | ||||
-rw-r--r-- | pkg/api/handlers/libpod/images.go | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go index 3546f88a0..edefce010 100644 --- a/pkg/api/handlers/compat/images.go +++ b/pkg/api/handlers/compat/images.go @@ -102,6 +102,7 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) { Comment string `schema:"comment"` Container string `schema:"container"` Pause bool `schema:"pause"` + Squash bool `schema:"squash"` Repo string `schema:"repo"` Tag string `schema:"tag"` // fromSrc string # fromSrc is currently unused @@ -138,6 +139,7 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) { options.Message = query.Comment options.Author = query.Author options.Pause = query.Pause + options.Squash = query.Squash for _, change := range query.Changes { options.Changes = append(options.Changes, strings.Split(change, "\n")...) } diff --git a/pkg/api/handlers/libpod/images.go b/pkg/api/handlers/libpod/images.go index f078c13cc..eb9fb12a6 100644 --- a/pkg/api/handlers/libpod/images.go +++ b/pkg/api/handlers/libpod/images.go @@ -497,6 +497,7 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) { Container string `schema:"container"` Format string `schema:"format"` Pause bool `schema:"pause"` + Squash bool `schema:"squash"` Repo string `schema:"repo"` Tag string `schema:"tag"` }{ @@ -543,6 +544,7 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) { options.Message = query.Comment options.Author = query.Author options.Pause = query.Pause + options.Squash = query.Squash options.Changes = query.Changes ctr, err := runtime.LookupContainer(query.Container) if err != nil { |