summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-02-26 15:15:36 -0600
committerBrent Baude <bbaude@redhat.com>2020-03-06 14:31:45 -0600
commit8b5e2a6297e6f6a5426551d1648278906a9d23de (patch)
tree7de8fe4102b581404dc3c012445750008a5b5495 /pkg/api
parenta61d05f667f6ba74ed060d5938e99d9838c1763f (diff)
downloadpodman-8b5e2a6297e6f6a5426551d1648278906a9d23de.tar.gz
podman-8b5e2a6297e6f6a5426551d1648278906a9d23de.tar.bz2
podman-8b5e2a6297e6f6a5426551d1648278906a9d23de.zip
add default network for apiv2 create
during container creation, if no network is provided, we need to add a default value so the container can be later started. use apiv2 container creation for RunTopContainer instead of an exec to the system podman. RunTopContainer now also returns the container id and an error. added a libpod commit endpoint. also, changed the use of the connections and bindings slightly to make it more convenient to write tests. Fixes: 5366 Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/containers.go1
-rw-r--r--pkg/api/server/register_images.go46
2 files changed, 45 insertions, 2 deletions
diff --git a/pkg/api/handlers/containers.go b/pkg/api/handlers/containers.go
index 31cbde229..1256256fd 100644
--- a/pkg/api/handlers/containers.go
+++ b/pkg/api/handlers/containers.go
@@ -72,7 +72,6 @@ func UnpauseContainer(w http.ResponseWriter, r *http.Request) {
return
}
- // the api does not error if the Container is already paused, so just into it
if err := con.Unpause(); err != nil {
utils.InternalServerError(w, err)
return
diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go
index db04ecdc9..2b164a7a7 100644
--- a/pkg/api/server/register_images.go
+++ b/pkg/api/server/register_images.go
@@ -942,6 +942,50 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/{name:.*}/tag"), s.APIHandler(handlers.TagImage)).Methods(http.MethodPost)
-
+ // swagger:operation POST /commit libpod libpodCommitContainer
+ // ---
+ // tags:
+ // - containers
+ // summary: Commit
+ // description: Create a new image from a container
+ // parameters:
+ // - in: query
+ // name: container
+ // type: string
+ // description: the name or ID of a container
+ // - in: query
+ // name: repo
+ // type: string
+ // description: the repository name for the created image
+ // - in: query
+ // name: tag
+ // type: string
+ // description: tag name for the created image
+ // - in: query
+ // name: comment
+ // type: string
+ // description: commit message
+ // - in: query
+ // name: author
+ // type: string
+ // description: author of the image
+ // - in: query
+ // name: pause
+ // type: boolean
+ // description: pause the container before committing it
+ // - in: query
+ // name: changes
+ // type: string
+ // description: instructions to apply while committing in Dockerfile format
+ // produces:
+ // - application/json
+ // responses:
+ // 201:
+ // description: no error
+ // 404:
+ // $ref: '#/responses/NoSuchImage'
+ // 500:
+ // $ref: '#/responses/InternalError'
+ r.Handle(VersionedPath("/commit"), s.APIHandler(generic.CommitContainer)).Methods(http.MethodPost)
return nil
}