Get container logs Run in API Explorer

GET /containers/{id}/logs

Get stdout and stderr logs from a container.

Note: This endpoint works only for containers with the json-file or journald logging driver.

Path parameters

  • id string Required

    ID or name of the container

Query parameters

  • follow boolean

    Keep connection after returning logs.

    Default value is false.

  • stdout boolean

    Return logs from stdout

    Default value is false.

  • stderr boolean

    Return logs from stderr

    Default value is false.

  • since integer

    Only return logs since this time, as a UNIX timestamp

    Default value is 0.

  • until integer

    Only return logs before this time, as a UNIX timestamp

    Default value is 0.

  • timestamps boolean

    Add timestamps to every log line

    Default value is false.

  • tail string

    Only return this number of log lines from the end of the logs. Specify as an integer or all to output all log lines.

    Default value is all.

Responses

GET /containers/{id}/logs
curl \
 --request GET 'http://api.example.com/v1.49/containers/{id}/logs'
Response examples (404)
{
  "message": "No such container: c2ada9df5af8"
}
Response examples (500)
{
  "message": "Something went wrong."
}