Podman exec API

Actions related to exec

OpenAPI Specification

podman-exec-api-openapi.yml Raw ↑
swagger: '2.0'
info:
  contact:
    email: podman@lists.podman.io
    name: Podman
    url: https://podman.io/community/
  description: 'This documentation describes the Podman v2.x+ RESTful API. It consists of a Docker-compatible

    API and a Libpod API providing support for Podman’s unique features such as pods.


    To start the service and keep it running for 5,000 seconds (-t 0 runs forever):


    podman system service -t 5000 &


    You can then use cURL on the socket using requests documented below.


    NOTE: if you install the package podman-docker, it will create a symbolic

    link for /run/docker.sock to /run/podman/podman.sock


    NOTE: Some fields in the API response JSON are encoded as omitempty, which means that

    if said field has a zero value, they will not be encoded in the API response. This

    is a feature to help reduce the size of the JSON responses returned via the API.


    NOTE: Due to the limitations of [go-swagger](https://github.com/go-swagger/go-swagger),

    some field values that have a complex type show up as null in the docs as well as in the

    API responses. This is because the zero value for the field type is null. The field

    description in the docs will state what type the field is expected to be for such cases.


    See podman-system-service(1) for more information.


    Quick Examples:


    ''podman info''


    curl --unix-socket /run/podman/podman.sock http://d/v6.0.0/libpod/info


    ''podman pull quay.io/containers/podman''


    curl -XPOST --unix-socket /run/podman/podman.sock -v ''http://d/v6.0.0/images/create?fromImage=quay.io%2Fcontainers%2Fpodman''


    ''podman list images''


    curl --unix-socket /run/podman/podman.sock -v ''http://d/v6.0.0/libpod/images/json'' | jq'
  license:
    name: Apache-2.0
    url: https://opensource.org/licenses/Apache-2.0
  termsOfService: https://github.com/containers/podman/blob/913caaa9b1de2b63692c9bae15120208194c9eb3/LICENSE
  title: supports a RESTful API for the Libpod library artifacts exec API
  version: 5.0.0
  x-logo:
  - url: https://raw.githubusercontent.com/containers/libpod/main/logo/podman-logo.png
  - altText: Podman logo
host: podman.io
basePath: /
schemes:
- http
- https
consumes:
- application/json
- application/x-tar
produces:
- application/json
- application/octet-stream
- text/plain
tags:
- description: Actions related to exec
  name: exec
paths:
  /libpod/containers/{name}/exec:
    post:
      description: Create an exec session to run a command inside a running container. Exec sessions will be automatically removed 5 minutes after they exit.
      operationId: ContainerExecLibpod
      parameters:
      - description: name of container
        in: path
        name: name
        required: true
        type: string
      - description: Attributes for create
        in: body
        name: control
        schema:
          properties:
            AttachStderr:
              description: Attach to stderr of the exec command
              type: boolean
            AttachStdin:
              description: Attach to stdin of the exec command
              type: boolean
            AttachStdout:
              description: Attach to stdout of the exec command
              type: boolean
            Cmd:
              description: Command to run, as a string or array of strings.
              items:
                type: string
              type: array
            DetachKeys:
              description: '"Override the key sequence for detaching a container. Format is a single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^, [, , or _."

                '
              type: string
            Env:
              description: A list of environment variables in the form ["VAR=value", ...]
              items:
                type: string
              type: array
            Privileged:
              default: false
              description: Runs the exec process with extended privileges
              type: boolean
            Tty:
              description: Allocate a pseudo-TTY
              type: boolean
            User:
              description: '"The user, and optionally, group to run the exec process inside the container. Format is one of: user, user:group, uid, or uid:gid."

                '
              type: string
            WorkingDir:
              description: The working directory for the exec process inside the container.
              type: string
          type: object
      produces:
      - application/json
      responses:
        '201':
          description: no error
        '404':
          $ref: '#/responses/containerNotFound'
        '409':
          description: container is paused
        '500':
          $ref: '#/responses/internalError'
      summary: Create an exec instance
      tags:
      - exec
  /libpod/exec/{id}/json:
    get:
      description: Return low-level information about an exec instance.
      operationId: ExecInspectLibpod
      parameters:
      - description: Exec instance ID
        in: path
        name: id
        required: true
        type: string
      produces:
      - application/json
      responses:
        '200':
          description: no error
        '404':
          $ref: '#/responses/execSessionNotFound'
        '500':
          $ref: '#/responses/internalError'
      summary: Inspect an exec instance
      tags:
      - exec
  /libpod/exec/{id}/resize:
    post:
      description: 'Resize the TTY session used by an exec instance. This endpoint only works if tty was specified as part of creating and starting the exec instance.

        '
      operationId: ExecResizeLibpod
      parameters:
      - description: Exec instance ID
        in: path
        name: id
        required: true
        type: string
      - description: Height of the TTY session in characters
        in: query
        name: h
        type: integer
      - description: Width of the TTY session in characters
        in: query
        name: w
        type: integer
      - description: Ignore containers not running errors
        in: query
        name: running
        type: boolean
      produces:
      - application/json
      responses:
        '201':
          description: no error
        '404':
          $ref: '#/responses/execSessionNotFound'
        '500':
          $ref: '#/responses/internalError'
      summary: Resize an exec instance
      tags:
      - exec
  /libpod/exec/{id}/start:
    post:
      description: 'Starts a previously set up exec instance. If detach is true, this endpoint returns immediately after starting the command.

        Otherwise, it sets up an interactive session with the command. The stream format is the same as the attach endpoint.

        '
      operationId: ExecStartLibpod
      parameters:
      - description: Exec instance ID
        in: path
        name: id
        required: true
        type: string
      - description: Attributes for start
        in: body
        name: control
        schema:
          properties:
            Detach:
              description: Detach from the command.
              type: boolean
            Tty:
              description: Allocate a pseudo-TTY.
              type: boolean
            h:
              description: Height of the TTY session in characters. Tty must be set to true to use it.
              type: integer
            w:
              description: Width of the TTY session in characters. Tty must be set to true to use it.
              type: integer
          type: object
      produces:
      - application/json
      responses:
        '200':
          description: no error
        '404':
          $ref: '#/responses/execSessionNotFound'
        '409':
          description: container is not running.
        '500':
          $ref: '#/responses/internalError'
      summary: Start an exec instance
      tags:
      - exec
definitions:
  ErrorModel:
    description: ErrorModel is used in remote connections with podman
    properties:
      cause:
        description: API root cause formatted for automated parsing
        example: API root cause
        type: string
        x-go-name: Because
      message:
        description: human error message, formatted for a human to read
        example: human error message
        type: string
        x-go-name: Message
      response:
        description: HTTP response code
        format: int64
        minimum: 400
        type: integer
        x-go-name: ResponseCode
    type: object
    x-go-package: go.podman.io/podman/v6/pkg/errorhandling
responses:
  containerNotFound:
    description: No such container
    schema:
      $ref: '#/definitions/ErrorModel'
  internalError:
    description: Internal server error
    schema:
      $ref: '#/definitions/ErrorModel'
  execSessionNotFound:
    description: No such exec instance
    schema:
      $ref: '#/definitions/ErrorModel'