Docker - logs of a container

Card Puncher Data Processing

About

Fetch the logs of a container (ie the console)

Syntax

Docker

docker logs [OPTIONS] CONTAINER

Fetch the logs of a container

Options:

--details        Show extra details provided to logs
  -f, --follow         Follow log output
      --help           Print usage
      --since string   Show logs since timestamp
      --tail string    Number of lines to show from the end of the logs (default "all")
  -t, --timestamps     Show timestamps

The -f flag causes the docker logs command to act like the tail -f command and watch the container’s standard output.

docker-compose

docker-compose logs --tail="10" -f Service

Example

Tail

Log tail of the last 10 line with timestamp

docker logs -f --tail 10 -t oraclexe
2017-08-15T19:55:55.936278872Z       ALTER DATABASE DROP LOGFILE GROUP 2
2017-08-15T19:55:55.936282823Z Deleted Oracle managed file /u01/app/oracle/fast_recovery_area/XE/onlinelog/o1_mf_2_ds6nf76r_.log
2017-08-15T19:55:55.936286695Z Completed:       ALTER DATABASE DROP LOGFILE GROUP 2
2017-08-15T19:55:55.936290401Z Cleared LOG_ARCHIVE_DEST_1 parameter default value
2017-08-15T19:55:55.936294553Z Using LOG_ARCHIVE_DEST_1 parameter default value as /u01/app/oracle/product/11.2.0/xe/dbs/arch
2017-08-15T19:55:55.936298289Z ALTER SYSTEM SET db_recovery_file_dest='' SCOPE=BOTH;
2017-08-15T20:00:50.667463276Z Tue Aug 15 20:00:50 2017
2017-08-15T20:00:50.667535991Z Starting background process SMCO
2017-08-15T20:00:50.667555809Z Tue Aug 15 20:00:50 2017
2017-08-15T20:00:50.667639899Z SMCO started with pid=27, OS id=832





Discover More
Docker For Windows Switch Container Type
Docker - Containers

in Docker. A container is a running instance of an image. Docker containers only run as long as the command you specify is active. A container ID uniquely identifies a container. A container...
Card Puncher Data Processing
Docker - docker client

The CLI uses the Docker REST API to control or interact with the Docker daemon where subcommand is: attach - Attach to a running container build - Build an image from a Dockerfile commit - Create...



Share this page:
Follow us:
Task Runner