0
0
Dockerdevops~10 mins

Docker logging drivers - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to run a Docker container with the default logging driver.

Docker
docker run --log-driver=[1] nginx
Drag options to blanks, or click blank then click option'
Ajson-file
Bsyslog
Cnone
Djournald
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'none' disables logging, which is not default.
Choosing 'syslog' or 'journald' requires extra setup.
2fill in blank
medium

Complete the command to run a Docker container using the syslog logging driver.

Docker
docker run --log-driver=[1] alpine echo hello
Drag options to blanks, or click blank then click option'
Ajson-file
Bfluentd
Cnone
Dsyslog
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'json-file' will keep logs local, not send to syslog.
Choosing 'none' disables logging.
3fill in blank
hard

Fix the error in the command to disable logging for a container.

Docker
docker run --log-driver=[1] busybox echo test
Drag options to blanks, or click blank then click option'
Asyslog
Bjson-file
Cnone
Djournald
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'json-file' or 'syslog' will still produce logs.
Choosing 'journald' sends logs to systemd journal, not disables.
4fill in blank
hard

Fill both blanks to configure a container to use the fluentd logging driver with a custom address.

Docker
docker run --log-driver=[1] --log-opt [2]=192.168.1.100:24224 alpine echo hi
Drag options to blanks, or click blank then click option'
Afluentd
Bsyslog-address
Cfluentd-address
Djson-file
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'syslog-address' option with fluentd driver is incorrect.
Choosing 'json-file' driver does not support fluentd options.
5fill in blank
hard

Fill all three blanks to create a Docker daemon configuration file snippet that sets the default logging driver to json-file with max size 10m and max files 3.

Docker
{
  "log-driver": "[1]",
  "log-opts": {
    "max-size": "[2]",
    "max-file": "[3]"
  }
}
Drag options to blanks, or click blank then click option'
Ajson-file
Bjournald
C10m
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'journald' instead of 'json-file' changes the logging system.
Setting max-size or max-file to wrong values causes config errors.