github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/pkg/api/server/register_images.go (about) 1 package server 2 3 import ( 4 "net/http" 5 6 "github.com/containers/podman/v2/pkg/api/handlers/compat" 7 "github.com/containers/podman/v2/pkg/api/handlers/libpod" 8 "github.com/gorilla/mux" 9 ) 10 11 // TODO 12 // 13 // * /images/create is missing the "message" and "platform" parameters 14 15 func (s *APIServer) registerImagesHandlers(r *mux.Router) error { 16 // swagger:operation POST /images/create compat createImage 17 // --- 18 // tags: 19 // - images (compat) 20 // summary: Create an image 21 // description: Create an image by either pulling it from a registry or importing it. 22 // produces: 23 // - application/json 24 // parameters: 25 // - in: query 26 // name: fromImage 27 // type: string 28 // description: needs description 29 // - in: query 30 // name: fromSrc 31 // type: string 32 // description: needs description 33 // - in: query 34 // name: tag 35 // type: string 36 // description: needs description 37 // - in: header 38 // name: X-Registry-Auth 39 // type: string 40 // description: A base64-encoded auth configuration. 41 // - in: body 42 // name: request 43 // schema: 44 // type: string 45 // description: Image content if fromSrc parameter was used 46 // responses: 47 // 200: 48 // $ref: "#/responses/ok" 49 // 404: 50 // $ref: "#/responses/NoSuchImage" 51 // 500: 52 // $ref: "#/responses/InternalError" 53 r.Handle(VersionedPath("/images/create"), s.APIHandler(compat.CreateImageFromImage)).Methods(http.MethodPost).Queries("fromImage", "{fromImage}") 54 // Added non version path to URI to support docker non versioned paths 55 r.Handle("/images/create", s.APIHandler(compat.CreateImageFromImage)).Methods(http.MethodPost).Queries("fromImage", "{fromImage}") 56 r.Handle(VersionedPath("/images/create"), s.APIHandler(compat.CreateImageFromSrc)).Methods(http.MethodPost).Queries("fromSrc", "{fromSrc}") 57 // Added non version path to URI to support docker non versioned paths 58 r.Handle("/images/create", s.APIHandler(compat.CreateImageFromSrc)).Methods(http.MethodPost).Queries("fromSrc", "{fromSrc}") 59 // swagger:operation GET /images/json compat listImages 60 // --- 61 // tags: 62 // - images (compat) 63 // summary: List Images 64 // description: Returns a list of images on the server. Note that it uses a different, smaller representation of an image than inspecting a single image. 65 // parameters: 66 // - name: all 67 // in: query 68 // description: "Show all images. Only images from a final layer (no children) are shown by default." 69 // type: boolean 70 // default: false 71 // - name: filters 72 // in: query 73 // description: | 74 // A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters: 75 // - `before`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) 76 // - `dangling=true` 77 // - `label=key` or `label="key=value"` of an image label 78 // - `reference`=(`<image-name>[:<tag>]`) 79 // - `since`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) 80 // type: string 81 // - name: digests 82 // in: query 83 // description: Not supported 84 // type: boolean 85 // default: false 86 // produces: 87 // - application/json 88 // responses: 89 // 200: 90 // $ref: "#/responses/DockerImageSummary" 91 // 500: 92 // $ref: '#/responses/InternalError' 93 r.Handle(VersionedPath("/images/json"), s.APIHandler(compat.GetImages)).Methods(http.MethodGet) 94 // Added non version path to URI to support docker non versioned paths 95 r.Handle("/images/json", s.APIHandler(compat.GetImages)).Methods(http.MethodGet) 96 // swagger:operation POST /images/load compat importImage 97 // --- 98 // tags: 99 // - images (compat) 100 // summary: Import image 101 // description: Load a set of images and tags into a repository. 102 // parameters: 103 // - in: query 104 // name: quiet 105 // type: boolean 106 // description: not supported 107 // - in: body 108 // name: request 109 // description: tarball of container image 110 // schema: 111 // type: string 112 // produces: 113 // - application/json 114 // responses: 115 // 200: 116 // description: no error 117 // 500: 118 // $ref: '#/responses/InternalError' 119 r.Handle(VersionedPath("/images/load"), s.APIHandler(compat.LoadImages)).Methods(http.MethodPost) 120 // Added non version path to URI to support docker non versioned paths 121 r.Handle("/images/load", s.APIHandler(compat.LoadImages)).Methods(http.MethodPost) 122 // swagger:operation POST /images/prune compat pruneImages 123 // --- 124 // tags: 125 // - images (compat) 126 // summary: Prune unused images 127 // description: Remove images from local storage that are not being used by a container 128 // parameters: 129 // - in: query 130 // name: filters 131 // type: string 132 // description: | 133 // filters to apply to image pruning, encoded as JSON (map[string][]string). Available filters: 134 // - `dangling=<boolean>` When set to `true` (or `1`), prune only 135 // unused *and* untagged images. When set to `false` 136 // (or `0`), all unused images are pruned. 137 // - `until=<string>` Prune images created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time. 138 // - `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune images with (or without, in case `label!=...` is used) the specified labels. 139 // produces: 140 // - application/json 141 // responses: 142 // 200: 143 // $ref: "#/responses/DocsImageDeleteResponse" 144 // 500: 145 // $ref: '#/responses/InternalError' 146 r.Handle(VersionedPath("/images/prune"), s.APIHandler(compat.PruneImages)).Methods(http.MethodPost) 147 // Added non version path to URI to support docker non versioned paths 148 r.Handle("/images/prune", s.APIHandler(compat.PruneImages)).Methods(http.MethodPost) 149 // swagger:operation GET /images/search compat searchImages 150 // --- 151 // tags: 152 // - images (compat) 153 // summary: Search images 154 // description: Search registries for an image 155 // parameters: 156 // - in: query 157 // name: term 158 // type: string 159 // description: term to search 160 // - in: query 161 // name: limit 162 // type: integer 163 // description: maximum number of results 164 // - in: query 165 // name: filters 166 // type: string 167 // description: | 168 // A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters: 169 // - `is-automated=(true|false)` 170 // - `is-official=(true|false)` 171 // - `stars=<number>` Matches images that has at least 'number' stars. 172 // - in: query 173 // name: listTags 174 // type: boolean 175 // description: list the available tags in the repository 176 // produces: 177 // - application/json 178 // responses: 179 // 200: 180 // $ref: "#/responses/DocsSearchResponse" 181 // 400: 182 // $ref: "#/responses/BadParamError" 183 // 500: 184 // $ref: '#/responses/InternalError' 185 r.Handle(VersionedPath("/images/search"), s.APIHandler(compat.SearchImages)).Methods(http.MethodGet) 186 // Added non version path to URI to support docker non versioned paths 187 r.Handle("/images/search", s.APIHandler(compat.SearchImages)).Methods(http.MethodGet) 188 // swagger:operation DELETE /images/{name:.*} compat removeImage 189 // --- 190 // tags: 191 // - images (compat) 192 // summary: Remove Image 193 // description: Delete an image from local storage 194 // parameters: 195 // - in: path 196 // name: name:.* 197 // type: string 198 // required: true 199 // description: name or ID of image to delete 200 // - in: query 201 // name: force 202 // type: boolean 203 // description: remove the image even if used by containers or has other tags 204 // - in: query 205 // name: noprune 206 // type: boolean 207 // description: not supported. will be logged as an invalid parameter if enabled 208 // produces: 209 // - application/json 210 // responses: 211 // 200: 212 // $ref: "#/responses/DocsImageDeleteResponse" 213 // 404: 214 // $ref: '#/responses/NoSuchImage' 215 // 409: 216 // $ref: '#/responses/ConflictError' 217 // 500: 218 // $ref: '#/responses/InternalError' 219 r.Handle(VersionedPath("/images/{name:.*}"), s.APIHandler(compat.RemoveImage)).Methods(http.MethodDelete) 220 // Added non version path to URI to support docker non versioned paths 221 r.Handle("/images/{name:.*}", s.APIHandler(compat.RemoveImage)).Methods(http.MethodDelete) 222 // swagger:operation POST /images/{name:.*}/push compat pushImage 223 // --- 224 // tags: 225 // - images (compat) 226 // summary: Push Image 227 // description: Push an image to a container registry 228 // parameters: 229 // - in: path 230 // name: name:.* 231 // type: string 232 // required: true 233 // description: Name of image to push. 234 // - in: query 235 // name: tag 236 // type: string 237 // description: The tag to associate with the image on the registry. 238 // - in: header 239 // name: X-Registry-Auth 240 // type: string 241 // description: A base64-encoded auth configuration. 242 // produces: 243 // - application/json 244 // responses: 245 // 200: 246 // description: no error 247 // schema: 248 // type: string 249 // format: binary 250 // 404: 251 // $ref: '#/responses/NoSuchImage' 252 // 500: 253 // $ref: '#/responses/InternalError' 254 r.Handle(VersionedPath("/images/{name:.*}/push"), s.APIHandler(compat.PushImage)).Methods(http.MethodPost) 255 // Added non version path to URI to support docker non versioned paths 256 r.Handle("/images/{name:.*}/push", s.APIHandler(compat.PushImage)).Methods(http.MethodPost) 257 // swagger:operation GET /images/{name:.*}/get compat exportImage 258 // --- 259 // tags: 260 // - images (compat) 261 // summary: Export an image 262 // description: Export an image in tarball format 263 // parameters: 264 // - in: path 265 // name: name:.* 266 // type: string 267 // required: true 268 // description: the name or ID of the container 269 // produces: 270 // - application/json 271 // responses: 272 // 200: 273 // description: no error 274 // schema: 275 // type: string 276 // format: binary 277 // 500: 278 // $ref: '#/responses/InternalError' 279 r.Handle(VersionedPath("/images/{name:.*}/get"), s.APIHandler(compat.ExportImage)).Methods(http.MethodGet) 280 // Added non version path to URI to support docker non versioned paths 281 r.Handle("/images/{name:.*}/get", s.APIHandler(compat.ExportImage)).Methods(http.MethodGet) 282 // swagger:operation GET /images/get compat get 283 // --- 284 // tags: 285 // - images (compat) 286 // summary: Export several images 287 // description: Get a tarball containing all images and metadata for several image repositories 288 // parameters: 289 // - in: query 290 // name: names 291 // type: string 292 // required: true 293 // description: one or more image names or IDs comma separated 294 // produces: 295 // - application/json 296 // responses: 297 // 200: 298 // description: no error 299 // schema: 300 // type: string 301 // format: binary 302 // 500: 303 // $ref: '#/responses/InternalError' 304 r.Handle(VersionedPath("/images/get"), s.APIHandler(compat.ExportImages)).Methods(http.MethodGet) 305 // Added non version path to URI to support docker non versioned paths 306 r.Handle("/images/get", s.APIHandler(compat.ExportImages)).Methods(http.MethodGet) 307 // swagger:operation GET /images/{name:.*}/history compat imageHistory 308 // --- 309 // tags: 310 // - images (compat) 311 // summary: History of an image 312 // description: Return parent layers of an image. 313 // parameters: 314 // - in: path 315 // name: name:.* 316 // type: string 317 // required: true 318 // description: the name or ID of the container 319 // produces: 320 // - application/json 321 // responses: 322 // 200: 323 // $ref: "#/responses/DocsHistory" 324 // 404: 325 // $ref: "#/responses/NoSuchImage" 326 // 500: 327 // $ref: "#/responses/InternalError" 328 r.Handle(VersionedPath("/images/{name:.*}/history"), s.APIHandler(compat.HistoryImage)).Methods(http.MethodGet) 329 // Added non version path to URI to support docker non versioned paths 330 r.Handle("/images/{name:.*}/history", s.APIHandler(compat.HistoryImage)).Methods(http.MethodGet) 331 // swagger:operation GET /images/{name:.*}/json compat inspectImage 332 // --- 333 // tags: 334 // - images (compat) 335 // summary: Inspect an image 336 // description: Return low-level information about an image. 337 // parameters: 338 // - in: path 339 // name: name:.* 340 // type: string 341 // required: true 342 // description: the name or ID of the container 343 // produces: 344 // - application/json 345 // responses: 346 // 200: 347 // $ref: "#/responses/DocsImageInspect" 348 // 404: 349 // $ref: "#/responses/NoSuchImage" 350 // 500: 351 // $ref: "#/responses/InternalError" 352 r.Handle(VersionedPath("/images/{name:.*}/json"), s.APIHandler(compat.GetImage)).Methods(http.MethodGet) 353 // Added non version path to URI to support docker non versioned paths 354 r.Handle("/images/{name:.*}/json", s.APIHandler(compat.GetImage)).Methods(http.MethodGet) 355 // swagger:operation POST /images/{name:.*}/tag compat tagImage 356 // --- 357 // tags: 358 // - images (compat) 359 // summary: Tag an image 360 // description: Tag an image so that it becomes part of a repository. 361 // parameters: 362 // - in: path 363 // name: name:.* 364 // type: string 365 // required: true 366 // description: the name or ID of the container 367 // - in: query 368 // name: repo 369 // type: string 370 // description: the repository to tag in 371 // - in: query 372 // name: tag 373 // type: string 374 // description: the name of the new tag 375 // produces: 376 // - application/json 377 // responses: 378 // 201: 379 // description: no error 380 // 400: 381 // $ref: '#/responses/BadParamError' 382 // 404: 383 // $ref: '#/responses/NoSuchImage' 384 // 409: 385 // $ref: '#/responses/ConflictError' 386 // 500: 387 // $ref: '#/responses/InternalError' 388 r.Handle(VersionedPath("/images/{name:.*}/tag"), s.APIHandler(compat.TagImage)).Methods(http.MethodPost) 389 // Added non version path to URI to support docker non versioned paths 390 r.Handle("/images/{name:.*}/tag", s.APIHandler(compat.TagImage)).Methods(http.MethodPost) 391 // swagger:operation POST /commit compat commitContainer 392 // --- 393 // tags: 394 // - containers (compat) 395 // summary: New Image 396 // description: Create a new image from a container 397 // parameters: 398 // - in: query 399 // name: container 400 // type: string 401 // description: the name or ID of a container 402 // - in: query 403 // name: repo 404 // type: string 405 // description: the repository name for the created image 406 // - in: query 407 // name: tag 408 // type: string 409 // description: tag name for the created image 410 // - in: query 411 // name: comment 412 // type: string 413 // description: commit message 414 // - in: query 415 // name: author 416 // type: string 417 // description: author of the image 418 // - in: query 419 // name: pause 420 // type: boolean 421 // description: pause the container before committing it 422 // - in: query 423 // name: changes 424 // type: string 425 // description: instructions to apply while committing in Dockerfile format 426 // produces: 427 // - application/json 428 // responses: 429 // 201: 430 // description: no error 431 // 404: 432 // $ref: '#/responses/NoSuchImage' 433 // 500: 434 // $ref: '#/responses/InternalError' 435 r.Handle(VersionedPath("/commit"), s.APIHandler(compat.CommitContainer)).Methods(http.MethodPost) 436 // Added non version path to URI to support docker non versioned paths 437 r.Handle("/commit", s.APIHandler(compat.CommitContainer)).Methods(http.MethodPost) 438 439 // swagger:operation POST /build compat buildImage 440 // --- 441 // tags: 442 // - images (compat) 443 // summary: Create image 444 // description: Build an image from the given Dockerfile(s) 445 // parameters: 446 // - in: query 447 // name: dockerfile 448 // type: string 449 // default: Dockerfile 450 // description: | 451 // Path within the build context to the `Dockerfile`. 452 // This is ignored if remote is specified and points to an external `Dockerfile`. 453 // - in: query 454 // name: t 455 // type: string 456 // default: latest 457 // description: A name and optional tag to apply to the image in the `name:tag` format. If you omit the tag the default latest value is assumed. You can provide several t parameters. 458 // - in: query 459 // name: extrahosts 460 // type: string 461 // default: 462 // description: | 463 // TBD Extra hosts to add to /etc/hosts 464 // (As of version 1.xx) 465 // - in: query 466 // name: remote 467 // type: string 468 // default: 469 // description: | 470 // A Git repository URI or HTTP/HTTPS context URI. 471 // If the URI points to a single text file, the file’s contents are placed 472 // into a file called Dockerfile and the image is built from that file. If 473 // the URI points to a tarball, the file is downloaded by the daemon and the 474 // contents therein used as the context for the build. If the URI points to a 475 // tarball and the dockerfile parameter is also specified, there must be a file 476 // with the corresponding path inside the tarball. 477 // (As of version 1.xx) 478 // - in: query 479 // name: q 480 // type: boolean 481 // default: false 482 // description: | 483 // Suppress verbose build output 484 // - in: query 485 // name: nocache 486 // type: boolean 487 // default: false 488 // description: | 489 // Do not use the cache when building the image 490 // (As of version 1.xx) 491 // - in: query 492 // name: cachefrom 493 // type: string 494 // default: 495 // description: | 496 // JSON array of images used to build cache resolution 497 // (As of version 1.xx) 498 // - in: query 499 // name: pull 500 // type: boolean 501 // default: false 502 // description: | 503 // Attempt to pull the image even if an older image exists locally 504 // (As of version 1.xx) 505 // - in: query 506 // name: rm 507 // type: boolean 508 // default: true 509 // description: | 510 // Remove intermediate containers after a successful build 511 // (As of version 1.xx) 512 // - in: query 513 // name: forcerm 514 // type: boolean 515 // default: false 516 // description: | 517 // Always remove intermediate containers, even upon failure 518 // (As of version 1.xx) 519 // - in: query 520 // name: memory 521 // type: integer 522 // description: | 523 // Memory is the upper limit (in bytes) on how much memory running containers can use 524 // (As of version 1.xx) 525 // - in: query 526 // name: memswap 527 // type: integer 528 // description: | 529 // MemorySwap limits the amount of memory and swap together 530 // (As of version 1.xx) 531 // - in: query 532 // name: cpushares 533 // type: integer 534 // description: | 535 // CPUShares (relative weight 536 // (As of version 1.xx) 537 // - in: query 538 // name: cpusetcpus 539 // type: string 540 // description: | 541 // CPUSetCPUs in which to allow execution (0-3, 0,1) 542 // (As of version 1.xx) 543 // - in: query 544 // name: cpuperiod 545 // type: integer 546 // description: | 547 // CPUPeriod limits the CPU CFS (Completely Fair Scheduler) period 548 // (As of version 1.xx) 549 // - in: query 550 // name: cpuquota 551 // type: integer 552 // description: | 553 // CPUQuota limits the CPU CFS (Completely Fair Scheduler) quota 554 // (As of version 1.xx) 555 // - in: query 556 // name: buildargs 557 // type: string 558 // default: 559 // description: | 560 // JSON map of string pairs denoting build-time variables. 561 // For example, the build argument `Foo` with the value of `bar` would be encoded in JSON as `["Foo":"bar"]`. 562 // 563 // For example, buildargs={"Foo":"bar"}. 564 // 565 // Note(s): 566 // * This should not be used to pass secrets. 567 // * The value of buildargs should be URI component encoded before being passed to the API. 568 // 569 // (As of version 1.xx) 570 // - in: query 571 // name: shmsize 572 // type: integer 573 // default: 67108864 574 // description: | 575 // ShmSize is the "size" value to use when mounting an shmfs on the container's /dev/shm directory. 576 // Default is 64MB 577 // (As of version 1.xx) 578 // - in: query 579 // name: squash 580 // type: boolean 581 // default: false 582 // description: | 583 // Silently ignored. 584 // Squash the resulting images layers into a single layer 585 // (As of version 1.xx) 586 // - in: query 587 // name: labels 588 // type: string 589 // default: 590 // description: | 591 // JSON map of key, value pairs to set as labels on the new image 592 // (As of version 1.xx) 593 // - in: query 594 // name: networkmode 595 // type: string 596 // default: bridge 597 // description: | 598 // Sets the networking mode for the run commands during build. 599 // Supported standard values are: 600 // * `bridge` limited to containers within a single host, port mapping required for external access 601 // * `host` no isolation between host and containers on this network 602 // * `none` disable all networking for this container 603 // * container:<nameOrID> share networking with given container 604 // ---All other values are assumed to be a custom network's name 605 // (As of version 1.xx) 606 // - in: query 607 // name: platform 608 // type: string 609 // default: 610 // description: | 611 // Platform format os[/arch[/variant]] 612 // (As of version 1.xx) 613 // - in: query 614 // name: target 615 // type: string 616 // default: 617 // description: | 618 // Target build stage 619 // (As of version 1.xx) 620 // - in: query 621 // name: outputs 622 // type: string 623 // default: 624 // description: | 625 // output configuration TBD 626 // (As of version 1.xx) 627 // produces: 628 // - application/json 629 // responses: 630 // 200: 631 // description: OK (As of version 1.xx) 632 // schema: 633 // type: object 634 // required: 635 // - stream 636 // properties: 637 // stream: 638 // type: string 639 // description: output from build process 640 // example: | 641 // (build details...) 642 // Successfully built 8ba084515c724cbf90d447a63600c0a6 643 // 400: 644 // $ref: "#/responses/BadParamError" 645 // 500: 646 // $ref: "#/responses/InternalError" 647 r.Handle(VersionedPath("/build"), s.APIHandler(compat.BuildImage)).Methods(http.MethodPost) 648 // Added non version path to URI to support docker non versioned paths 649 r.Handle("/build", s.APIHandler(compat.BuildImage)).Methods(http.MethodPost) 650 /* 651 libpod endpoints 652 */ 653 654 // swagger:operation POST /libpod/images/{name:.*}/push libpod libpodPushImage 655 // --- 656 // tags: 657 // - images 658 // summary: Push Image 659 // description: Push an image to a container registry 660 // parameters: 661 // - in: path 662 // name: name:.* 663 // type: string 664 // required: true 665 // description: Name of image to push. 666 // - in: query 667 // name: destination 668 // type: string 669 // description: Allows for pushing the image to a different destintation than the image refers to. 670 // - in: query 671 // name: tlsVerify 672 // description: Require TLS verification. 673 // type: boolean 674 // default: true 675 // - in: header 676 // name: X-Registry-Auth 677 // type: string 678 // description: A base64-encoded auth configuration. 679 // produces: 680 // - application/json 681 // responses: 682 // 200: 683 // description: no error 684 // schema: 685 // type: string 686 // format: binary 687 // 404: 688 // $ref: '#/responses/NoSuchImage' 689 // 500: 690 // $ref: '#/responses/InternalError' 691 r.Handle(VersionedPath("/libpod/images/{name:.*}/push"), s.APIHandler(libpod.PushImage)).Methods(http.MethodPost) 692 // swagger:operation GET /libpod/images/{name:.*}/exists libpod libpodImageExists 693 // --- 694 // tags: 695 // - images 696 // summary: Image exists 697 // description: Check if image exists in local store 698 // parameters: 699 // - in: path 700 // name: name:.* 701 // type: string 702 // required: true 703 // description: the name or ID of the container 704 // produces: 705 // - application/json 706 // responses: 707 // 204: 708 // description: image exists 709 // 404: 710 // $ref: '#/responses/NoSuchImage' 711 // 500: 712 // $ref: '#/responses/InternalError' 713 r.Handle(VersionedPath("/libpod/images/{name:.*}/exists"), s.APIHandler(libpod.ImageExists)).Methods(http.MethodGet) 714 // swagger:operation GET /libpod/images/{name:.*}/tree libpod libpodImageTree 715 // --- 716 // tags: 717 // - images 718 // summary: Image tree 719 // description: Retrieve the image tree for the provided image name or ID 720 // parameters: 721 // - in: path 722 // name: name:.* 723 // type: string 724 // required: true 725 // description: the name or ID of the container 726 // - in: query 727 // name: whatrequires 728 // type: boolean 729 // description: show all child images and layers of the specified image 730 // produces: 731 // - application/json 732 // responses: 733 // 200: 734 // $ref: '#/responses/LibpodImageTreeResponse' 735 // 404: 736 // $ref: '#/responses/NoSuchImage' 737 // 500: 738 // $ref: '#/responses/InternalError' 739 r.Handle(VersionedPath("/libpod/images/{name:.*}/tree"), s.APIHandler(libpod.ImageTree)).Methods(http.MethodGet) 740 // swagger:operation GET /libpod/images/{name:.*}/history libpod libpodImageHistory 741 // --- 742 // tags: 743 // - images 744 // summary: History of an image 745 // description: Return parent layers of an image. 746 // parameters: 747 // - in: path 748 // name: name:.* 749 // type: string 750 // required: true 751 // description: the name or ID of the container 752 // produces: 753 // - application/json 754 // responses: 755 // 200: 756 // $ref: "#/responses/DocsHistory" 757 // 404: 758 // $ref: '#/responses/NoSuchImage' 759 // 500: 760 // $ref: '#/responses/InternalError' 761 r.Handle(VersionedPath("/libpod/images/{name:.*}/history"), s.APIHandler(compat.HistoryImage)).Methods(http.MethodGet) 762 // swagger:operation GET /libpod/images/json libpod libpodListImages 763 // --- 764 // tags: 765 // - images 766 // summary: List Images 767 // description: Returns a list of images on the server 768 // parameters: 769 // - name: all 770 // in: query 771 // description: Show all images. Only images from a final layer (no children) are shown by default. 772 // type: boolean 773 // default: false 774 // - name: filters 775 // in: query 776 // description: | 777 // A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters: 778 // - `before`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) 779 // - `dangling=true` 780 // - `label=key` or `label="key=value"` of an image label 781 // - `reference`=(`<image-name>[:<tag>]`) 782 // - `id`=(`<image-id>`) 783 // - `since`=(`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) 784 // type: string 785 // produces: 786 // - application/json 787 // responses: 788 // 200: 789 // $ref: "#/responses/DockerImageSummary" 790 // 500: 791 // $ref: '#/responses/InternalError' 792 r.Handle(VersionedPath("/libpod/images/json"), s.APIHandler(libpod.GetImages)).Methods(http.MethodGet) 793 // swagger:operation POST /libpod/images/load libpod libpodImagesLoad 794 // --- 795 // tags: 796 // - images 797 // summary: Load image 798 // description: Load an image (oci-archive or docker-archive) stream. 799 // parameters: 800 // - in: query 801 // name: reference 802 // description: "Optional Name[:TAG] for the image" 803 // type: string 804 // - in: formData 805 // name: upload 806 // description: tarball of container image 807 // type: file 808 // required: true 809 // produces: 810 // - application/json 811 // responses: 812 // 200: 813 // $ref: "#/responses/DocsLibpodImagesLoadResponse" 814 // 400: 815 // $ref: "#/responses/BadParamError" 816 // 500: 817 // $ref: '#/responses/InternalError' 818 r.Handle(VersionedPath("/libpod/images/load"), s.APIHandler(libpod.ImagesLoad)).Methods(http.MethodPost) 819 // swagger:operation POST /libpod/images/import libpod libpodImagesImport 820 // --- 821 // tags: 822 // - images 823 // summary: Import image 824 // description: Import a previously exported tarball as an image. 825 // parameters: 826 // - in: query 827 // name: changes 828 // description: "Apply the following possible instructions to the created image: CMD | ENTRYPOINT | ENV | EXPOSE | LABEL | STOPSIGNAL | USER | VOLUME | WORKDIR. JSON encoded string" 829 // type: array 830 // items: 831 // type: string 832 // - in: query 833 // name: message 834 // description: Set commit message for imported image 835 // type: string 836 // - in: query 837 // name: reference 838 // description: "Optional Name[:TAG] for the image" 839 // type: string 840 // - in: query 841 // name: url 842 // description: Load image from the specified URL 843 // type: string 844 // - in: formData 845 // name: upload 846 // type: file 847 // required: true 848 // description: tarball for imported image 849 // produces: 850 // - application/json 851 // responses: 852 // 200: 853 // $ref: "#/responses/DocsLibpodImagesImportResponse" 854 // 400: 855 // $ref: "#/responses/BadParamError" 856 // 500: 857 // $ref: '#/responses/InternalError' 858 r.Handle(VersionedPath("/libpod/images/import"), s.APIHandler(libpod.ImagesImport)).Methods(http.MethodPost) 859 // swagger:operation DELETE /libpod/images/remove libpod libpodImagesRemove 860 // --- 861 // tags: 862 // - images 863 // summary: Remove one or more images from the storage. 864 // description: Remove one or more images from the storage. 865 // parameters: 866 // - in: query 867 // name: images 868 // description: Images IDs or names to remove. 869 // type: array 870 // items: 871 // type: string 872 // - in: query 873 // name: all 874 // description: Remove all images. 875 // type: boolean 876 // default: true 877 // - in: query 878 // name: force 879 // description: Force image removal (including containers using the images). 880 // type: boolean 881 // produces: 882 // - application/json 883 // responses: 884 // 200: 885 // $ref: "#/responses/DocsLibpodImagesRemoveResponse" 886 // 400: 887 // $ref: "#/responses/BadParamError" 888 // 500: 889 // $ref: '#/responses/InternalError' 890 r.Handle(VersionedPath("/libpod/images/remove"), s.APIHandler(libpod.ImagesBatchRemove)).Methods(http.MethodDelete) 891 // swagger:operation DELETE /libpod/images/{name:.*} libpod libpodRemoveImage 892 // --- 893 // tags: 894 // - images 895 // summary: Remove an image from the local storage. 896 // description: Remove an image from the local storage. 897 // parameters: 898 // - in: path 899 // name: name:.* 900 // type: string 901 // required: true 902 // description: name or ID of image to remove 903 // - in: query 904 // name: force 905 // type: boolean 906 // description: remove the image even if used by containers or has other tags 907 // produces: 908 // - application/json 909 // responses: 910 // 200: 911 // $ref: "#/responses/DocsImageDeleteResponse" 912 // 400: 913 // $ref: "#/responses/BadParamError" 914 // 404: 915 // $ref: '#/responses/NoSuchImage' 916 // 409: 917 // $ref: '#/responses/ConflictError' 918 // 500: 919 // $ref: '#/responses/InternalError' 920 r.Handle(VersionedPath("/libpod/images/{name:.*}"), s.APIHandler(libpod.ImagesRemove)).Methods(http.MethodDelete) 921 // swagger:operation POST /libpod/images/pull libpod libpodImagesPull 922 // --- 923 // tags: 924 // - images 925 // summary: Pull images 926 // description: Pull one or more images from a container registry. 927 // parameters: 928 // - in: query 929 // name: reference 930 // description: "Mandatory reference to the image (e.g., quay.io/image/name:tag)" 931 // type: string 932 // - in: query 933 // name: credentials 934 // description: "username:password for the registry" 935 // type: string 936 // - in: query 937 // name: overrideArch 938 // description: Pull image for the specified architecture. 939 // type: string 940 // - in: query 941 // name: overrideOS 942 // description: Pull image for the specified operating system. 943 // type: string 944 // - in: query 945 // name: overrideVariant 946 // description: Pull image for the specified variant. 947 // type: string 948 // - in: query 949 // name: tlsVerify 950 // description: Require TLS verification. 951 // type: boolean 952 // default: true 953 // - in: query 954 // name: allTags 955 // description: Pull all tagged images in the repository. 956 // type: boolean 957 // produces: 958 // - application/json 959 // responses: 960 // 200: 961 // $ref: "#/responses/DocsLibpodImagesPullResponse" 962 // 400: 963 // $ref: "#/responses/BadParamError" 964 // 500: 965 // $ref: '#/responses/InternalError' 966 r.Handle(VersionedPath("/libpod/images/pull"), s.APIHandler(libpod.ImagesPull)).Methods(http.MethodPost) 967 // swagger:operation POST /libpod/images/prune libpod libpodPruneImages 968 // --- 969 // tags: 970 // - images 971 // summary: Prune unused images 972 // description: Remove images that are not being used by a container 973 // parameters: 974 // - in: query 975 // name: filters 976 // type: string 977 // description: | 978 // filters to apply to image pruning, encoded as JSON (map[string][]string). Available filters: 979 // - `dangling=<boolean>` When set to `true` (or `1`), prune only 980 // unused *and* untagged images. When set to `false` 981 // (or `0`), all unused images are pruned. 982 // - `until=<string>` Prune images created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time. 983 // - `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune images with (or without, in case `label!=...` is used) the specified labels. 984 // produces: 985 // - application/json 986 // responses: 987 // 200: 988 // $ref: "#/responses/DocsImageDeleteResponse" 989 // 500: 990 // $ref: '#/responses/InternalError' 991 r.Handle(VersionedPath("/libpod/images/prune"), s.APIHandler(libpod.PruneImages)).Methods(http.MethodPost) 992 // swagger:operation GET /libpod/images/search libpod libpodSearchImages 993 // --- 994 // tags: 995 // - images 996 // summary: Search images 997 // description: Search registries for images 998 // parameters: 999 // - in: query 1000 // name: term 1001 // type: string 1002 // description: term to search 1003 // - in: query 1004 // name: limit 1005 // type: integer 1006 // description: maximum number of results 1007 // - in: query 1008 // name: noTrunc 1009 // type: boolean 1010 // description: do not truncate any of the result strings 1011 // - in: query 1012 // name: filters 1013 // type: string 1014 // description: | 1015 // A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters: 1016 // - `is-automated=(true|false)` 1017 // - `is-official=(true|false)` 1018 // - `stars=<number>` Matches images that has at least 'number' stars. 1019 // produces: 1020 // - application/json 1021 // responses: 1022 // 200: 1023 // $ref: "#/responses/DocsSearchResponse" 1024 // 500: 1025 // $ref: '#/responses/InternalError' 1026 r.Handle(VersionedPath("/libpod/images/search"), s.APIHandler(libpod.SearchImages)).Methods(http.MethodGet) 1027 // swagger:operation GET /libpod/images/{name:.*}/get libpod libpodExportImage 1028 // --- 1029 // tags: 1030 // - images 1031 // summary: Export an image 1032 // description: Export an image 1033 // parameters: 1034 // - in: path 1035 // name: name:.* 1036 // type: string 1037 // required: true 1038 // description: the name or ID of the container 1039 // - in: query 1040 // name: format 1041 // type: string 1042 // description: format for exported image 1043 // - in: query 1044 // name: compress 1045 // type: boolean 1046 // description: use compression on image 1047 // produces: 1048 // - application/json 1049 // responses: 1050 // 200: 1051 // description: no error 1052 // schema: 1053 // type: string 1054 // format: binary 1055 // 404: 1056 // $ref: '#/responses/NoSuchImage' 1057 // 500: 1058 // $ref: '#/responses/InternalError' 1059 r.Handle(VersionedPath("/libpod/images/{name:.*}/get"), s.APIHandler(libpod.ExportImage)).Methods(http.MethodGet) 1060 // swagger:operation GET /libpod/images/export libpod libpodExportImages 1061 // --- 1062 // tags: 1063 // - images 1064 // summary: Export multiple images 1065 // description: Export multiple images into a single object. Only `docker-archive` is currently supported. 1066 // parameters: 1067 // - in: query 1068 // name: format 1069 // type: string 1070 // description: format for exported image (only docker-archive is supported) 1071 // - in: query 1072 // name: references 1073 // description: references to images to export 1074 // type: array 1075 // items: 1076 // type: string 1077 // - in: query 1078 // name: compress 1079 // type: boolean 1080 // description: use compression on image 1081 // produces: 1082 // - application/json 1083 // responses: 1084 // 200: 1085 // description: no error 1086 // schema: 1087 // type: string 1088 // format: binary 1089 // 404: 1090 // $ref: '#/responses/NoSuchImage' 1091 // 500: 1092 // $ref: '#/responses/InternalError' 1093 r.Handle(VersionedPath("/libpod/images/export"), s.APIHandler(libpod.ExportImages)).Methods(http.MethodGet) 1094 // swagger:operation GET /libpod/images/{name:.*}/json libpod libpodInspectImage 1095 // --- 1096 // tags: 1097 // - images 1098 // summary: Inspect an image 1099 // description: Obtain low-level information about an image 1100 // parameters: 1101 // - in: path 1102 // name: name:.* 1103 // type: string 1104 // required: true 1105 // description: the name or ID of the container 1106 // produces: 1107 // - application/json 1108 // responses: 1109 // 200: 1110 // $ref: "#/responses/DocsLibpodInspectImageResponse" 1111 // 404: 1112 // $ref: '#/responses/NoSuchImage' 1113 // 500: 1114 // $ref: '#/responses/InternalError' 1115 r.Handle(VersionedPath("/libpod/images/{name:.*}/json"), s.APIHandler(libpod.GetImage)).Methods(http.MethodGet) 1116 // swagger:operation POST /libpod/images/{name:.*}/tag libpod libpodTagImage 1117 // --- 1118 // tags: 1119 // - images 1120 // summary: Tag an image 1121 // description: Tag an image so that it becomes part of a repository. 1122 // parameters: 1123 // - in: path 1124 // name: name:.* 1125 // type: string 1126 // required: true 1127 // description: the name or ID of the container 1128 // - in: query 1129 // name: repo 1130 // type: string 1131 // description: the repository to tag in 1132 // - in: query 1133 // name: tag 1134 // type: string 1135 // description: the name of the new tag 1136 // produces: 1137 // - application/json 1138 // responses: 1139 // 201: 1140 // description: no error 1141 // 400: 1142 // $ref: '#/responses/BadParamError' 1143 // 404: 1144 // $ref: '#/responses/NoSuchImage' 1145 // 409: 1146 // $ref: '#/responses/ConflictError' 1147 // 500: 1148 // $ref: '#/responses/InternalError' 1149 r.Handle(VersionedPath("/libpod/images/{name:.*}/tag"), s.APIHandler(compat.TagImage)).Methods(http.MethodPost) 1150 // swagger:operation POST /libpod/commit libpod libpodCommitContainer 1151 // --- 1152 // tags: 1153 // - containers 1154 // summary: Commit 1155 // description: Create a new image from a container 1156 // parameters: 1157 // - in: query 1158 // name: container 1159 // type: string 1160 // description: the name or ID of a container 1161 // required: true 1162 // - in: query 1163 // name: repo 1164 // type: string 1165 // description: the repository name for the created image 1166 // - in: query 1167 // name: tag 1168 // type: string 1169 // description: tag name for the created image 1170 // - in: query 1171 // name: comment 1172 // type: string 1173 // description: commit message 1174 // - in: query 1175 // name: author 1176 // type: string 1177 // description: author of the image 1178 // - in: query 1179 // name: pause 1180 // type: boolean 1181 // description: pause the container before committing it 1182 // - in: query 1183 // name: changes 1184 // description: instructions to apply while committing in Dockerfile format (i.e. "CMD=/bin/foo") 1185 // type: array 1186 // items: 1187 // type: string 1188 // - in: query 1189 // name: format 1190 // type: string 1191 // description: format of the image manifest and metadata (default "oci") 1192 // produces: 1193 // - application/json 1194 // responses: 1195 // 201: 1196 // description: no error 1197 // 404: 1198 // $ref: '#/responses/NoSuchImage' 1199 // 500: 1200 // $ref: '#/responses/InternalError' 1201 r.Handle(VersionedPath("/libpod/commit"), s.APIHandler(libpod.CommitContainer)).Methods(http.MethodPost) 1202 // swagger:operation POST /libpod/images/{name:.*}/untag libpod libpodUntagImage 1203 // --- 1204 // tags: 1205 // - images 1206 // summary: Untag an image 1207 // description: Untag an image. If not repo and tag are specified, all tags are removed from the image. 1208 // parameters: 1209 // - in: path 1210 // name: name:.* 1211 // type: string 1212 // required: true 1213 // description: the name or ID of the container 1214 // - in: query 1215 // name: repo 1216 // type: string 1217 // description: the repository to untag 1218 // - in: query 1219 // name: tag 1220 // type: string 1221 // description: the name of the tag to untag 1222 // produces: 1223 // - application/json 1224 // responses: 1225 // 201: 1226 // description: no error 1227 // 400: 1228 // $ref: '#/responses/BadParamError' 1229 // 404: 1230 // $ref: '#/responses/NoSuchImage' 1231 // 409: 1232 // $ref: '#/responses/ConflictError' 1233 // 500: 1234 // $ref: '#/responses/InternalError' 1235 r.Handle(VersionedPath("/libpod/images/{name:.*}/untag"), s.APIHandler(libpod.UntagImage)).Methods(http.MethodPost) 1236 1237 // swagger:operation GET /libpod/images/{name}/changes libpod libpodChangesImages 1238 // --- 1239 // tags: 1240 // - images 1241 // summary: Report on changes to images's filesystem; adds, deletes or modifications. 1242 // description: | 1243 // Returns which files in a images's filesystem have been added, deleted, or modified. The Kind of modification can be one of: 1244 // 1245 // 0: Modified 1246 // 1: Added 1247 // 2: Deleted 1248 // parameters: 1249 // - in: path 1250 // name: name 1251 // type: string 1252 // required: true 1253 // description: the name or id of the container 1254 // responses: 1255 // 200: 1256 // description: Array of Changes 1257 // content: 1258 // application/json: 1259 // schema: 1260 // $ref: "#/responses/Changes" 1261 // 404: 1262 // $ref: "#/responses/NoSuchContainer" 1263 // 500: 1264 // $ref: "#/responses/InternalError" 1265 r.HandleFunc(VersionedPath("/libpod/images/{name}/changes"), s.APIHandler(compat.Changes)).Methods(http.MethodGet) 1266 1267 // swagger:operation POST /libpod/build libpod libpodBuildImage 1268 // --- 1269 // tags: 1270 // - images 1271 // summary: Create image 1272 // description: Build an image from the given Dockerfile(s) 1273 // parameters: 1274 // - in: query 1275 // name: dockerfile 1276 // type: string 1277 // default: Dockerfile 1278 // description: | 1279 // Path within the build context to the `Dockerfile`. 1280 // This is ignored if remote is specified and points to an external `Dockerfile`. 1281 // - in: query 1282 // name: t 1283 // type: string 1284 // default: latest 1285 // description: A name and optional tag to apply to the image in the `name:tag` format. If you omit the tag the default latest value is assumed. You can provide several t parameters. 1286 // - in: query 1287 // name: extrahosts 1288 // type: string 1289 // default: 1290 // description: | 1291 // TBD Extra hosts to add to /etc/hosts 1292 // (As of version 1.xx) 1293 // - in: query 1294 // name: remote 1295 // type: string 1296 // default: 1297 // description: | 1298 // A Git repository URI or HTTP/HTTPS context URI. 1299 // If the URI points to a single text file, the file’s contents are placed 1300 // into a file called Dockerfile and the image is built from that file. If 1301 // the URI points to a tarball, the file is downloaded by the daemon and the 1302 // contents therein used as the context for the build. If the URI points to a 1303 // tarball and the dockerfile parameter is also specified, there must be a file 1304 // with the corresponding path inside the tarball. 1305 // (As of version 1.xx) 1306 // - in: query 1307 // name: q 1308 // type: boolean 1309 // default: false 1310 // description: | 1311 // Suppress verbose build output 1312 // - in: query 1313 // name: nocache 1314 // type: boolean 1315 // default: false 1316 // description: | 1317 // Do not use the cache when building the image 1318 // (As of version 1.xx) 1319 // - in: query 1320 // name: cachefrom 1321 // type: string 1322 // default: 1323 // description: | 1324 // JSON array of images used to build cache resolution 1325 // (As of version 1.xx) 1326 // - in: query 1327 // name: pull 1328 // type: boolean 1329 // default: false 1330 // description: | 1331 // Attempt to pull the image even if an older image exists locally 1332 // (As of version 1.xx) 1333 // - in: query 1334 // name: rm 1335 // type: boolean 1336 // default: true 1337 // description: | 1338 // Remove intermediate containers after a successful build 1339 // (As of version 1.xx) 1340 // - in: query 1341 // name: forcerm 1342 // type: boolean 1343 // default: false 1344 // description: | 1345 // Always remove intermediate containers, even upon failure 1346 // (As of version 1.xx) 1347 // - in: query 1348 // name: memory 1349 // type: integer 1350 // description: | 1351 // Memory is the upper limit (in bytes) on how much memory running containers can use 1352 // (As of version 1.xx) 1353 // - in: query 1354 // name: memswap 1355 // type: integer 1356 // description: | 1357 // MemorySwap limits the amount of memory and swap together 1358 // (As of version 1.xx) 1359 // - in: query 1360 // name: cpushares 1361 // type: integer 1362 // description: | 1363 // CPUShares (relative weight 1364 // (As of version 1.xx) 1365 // - in: query 1366 // name: cpusetcpus 1367 // type: string 1368 // description: | 1369 // CPUSetCPUs in which to allow execution (0-3, 0,1) 1370 // (As of version 1.xx) 1371 // - in: query 1372 // name: cpuperiod 1373 // type: integer 1374 // description: | 1375 // CPUPeriod limits the CPU CFS (Completely Fair Scheduler) period 1376 // (As of version 1.xx) 1377 // - in: query 1378 // name: cpuquota 1379 // type: integer 1380 // description: | 1381 // CPUQuota limits the CPU CFS (Completely Fair Scheduler) quota 1382 // (As of version 1.xx) 1383 // - in: query 1384 // name: buildargs 1385 // type: string 1386 // default: 1387 // description: | 1388 // JSON map of string pairs denoting build-time variables. 1389 // For example, the build argument `Foo` with the value of `bar` would be encoded in JSON as `["Foo":"bar"]`. 1390 // 1391 // For example, buildargs={"Foo":"bar"}. 1392 // 1393 // Note(s): 1394 // * This should not be used to pass secrets. 1395 // * The value of buildargs should be URI component encoded before being passed to the API. 1396 // 1397 // (As of version 1.xx) 1398 // - in: query 1399 // name: shmsize 1400 // type: integer 1401 // default: 67108864 1402 // description: | 1403 // ShmSize is the "size" value to use when mounting an shmfs on the container's /dev/shm directory. 1404 // Default is 64MB 1405 // (As of version 1.xx) 1406 // - in: query 1407 // name: squash 1408 // type: boolean 1409 // default: false 1410 // description: | 1411 // Silently ignored. 1412 // Squash the resulting images layers into a single layer 1413 // (As of version 1.xx) 1414 // - in: query 1415 // name: labels 1416 // type: string 1417 // default: 1418 // description: | 1419 // JSON map of key, value pairs to set as labels on the new image 1420 // (As of version 1.xx) 1421 // - in: query 1422 // name: networkmode 1423 // type: string 1424 // default: bridge 1425 // description: | 1426 // Sets the networking mode for the run commands during build. 1427 // Supported standard values are: 1428 // * `bridge` limited to containers within a single host, port mapping required for external access 1429 // * `host` no isolation between host and containers on this network 1430 // * `none` disable all networking for this container 1431 // * container:<nameOrID> share networking with given container 1432 // ---All other values are assumed to be a custom network's name 1433 // (As of version 1.xx) 1434 // - in: query 1435 // name: platform 1436 // type: string 1437 // default: 1438 // description: | 1439 // Platform format os[/arch[/variant]] 1440 // (As of version 1.xx) 1441 // - in: query 1442 // name: target 1443 // type: string 1444 // default: 1445 // description: | 1446 // Target build stage 1447 // (As of version 1.xx) 1448 // - in: query 1449 // name: outputs 1450 // type: string 1451 // default: 1452 // description: | 1453 // output configuration TBD 1454 // (As of version 1.xx) 1455 // - in: query 1456 // name: httpproxy 1457 // type: boolean 1458 // default: 1459 // description: | 1460 // Inject http proxy environment variables into container 1461 // (As of version 2.0.0) 1462 // produces: 1463 // - application/json 1464 // responses: 1465 // 200: 1466 // description: OK (As of version 1.xx) 1467 // schema: 1468 // type: object 1469 // required: 1470 // - stream 1471 // properties: 1472 // stream: 1473 // type: string 1474 // description: output from build process 1475 // example: | 1476 // (build details...) 1477 // Successfully built 8ba084515c724cbf90d447a63600c0a6 1478 // 400: 1479 // $ref: "#/responses/BadParamError" 1480 // 500: 1481 // $ref: "#/responses/InternalError" 1482 r.Handle(VersionedPath("/libpod/build"), s.APIHandler(compat.BuildImage)).Methods(http.MethodPost) 1483 return nil 1484 }