instruction: Explain Logs and metrics
output: Back
  Ask AI
  Start typing to search or try
  Contact support
  Manuals
  Get started
  Guides
  View container logs
  Page options
  Copy page as Markdown for LLMs
  View page as plain text
  Ask questions with Docs AI
  Claude
  Open in Claude
  docker logs
  command shows information logged by a running container. The
  docker service logs
  command shows information logged by all containers
  participating in a service. The information that's logged and the format of the
  log depends almost entirely on the container's endpoint command.
  By default,
  docker logs
  docker service logs
  shows the command's output
  just as it would appear if you ran the command interactively in a terminal. Unix
  and Linux commands typically open three I/O streams when they run, called
  STDIN
  STDOUT
  , and
  STDERR
  STDIN
  is the command's input stream, which
  may include input from the keyboard or input from another command.
  STDOUT
  usually a command's normal output, and
  STDERR
  is typically used to output
  error messages. By default,
  docker logs
  shows the command's
  STDOUT
  STDERR
  . To read more about I/O and Linux, see the
  Linux Documentation Project article on I/O redirection
  In some cases,
  docker logs
  may not show useful information unless you take
  additional steps.
  If you use a
  logging driver
  which sends logs to a file, an
  external host, a database, or another logging back-end, and have
  "dual logging"
  disabled,
  docker logs
  may not show useful information.
  If your image runs a non-interactive process such as a web server or a
  database, that application may send its output to log files instead of
  STDOUT
  STDERR
  In the first case, your logs are processed in other ways and you may choose not
  to use
  docker logs
  . In the second case, the official
  nginx
  image shows one
  workaround, and the official Apache
  httpd
  image shows another.
  The official
  nginx
  image creates a symbolic link from
  /var/log/nginx/access.log
  /dev/stdout
  , and creates another symbolic link
  from
  /var/log/nginx/error.log
  /dev/stderr
  , overwriting the log files and
  causing logs to be sent to the relevant special device instead. See the
  Dockerfile
  The official
  httpd
  driver changes the
  httpd
  application's configuration to
  write its normal output directly to
  /proc/self/fd/1
  (which is
  STDOUT
  ) and
  its errors to
  /proc/self/fd/2
  (which is
  STDERR
  ). See the
  Dockerfile
  Next steps
  Configure
  logging drivers
  Write a
  Dockerfile