docker logs查看
查看docker logs:
docker service logs 容器名 -t -f --tail 10
docker service logs web_1 -t -f --tail 10
-f : 查看实时日志
-t : 查看日志产生的日期
-tail=10 : 查看最后的10条日志
web_1 : 容器名称
查看实时logs:
$ docker logs [OPTIONS] CONTAINER
Options:
--details 显示更多的信息
-f, --follow 跟踪日志输出,最后一行为当前时间戳的日志
--since string 显示自具体某个时间或时间段的日志
--tail string 从日志末尾显示多少行日志, 默认是all
-t,
$ docker logs 26b12d17fefc
nohup: appending output to 'nohup.out'
nohup: appending output to 'nohup.out'
$ docker logs -t 26b12d17fefc
2017-07-03T12:12:29.909710295Z nohup: appending output to 'nohup.out'
2017-07-03T13:58:54.232003809Z nohup: appending output to 'nohup.out'
$ docker logs --tail 1 26b12d17fefc
nohup: appending output to 'nohup.out'
$ docker logs -t --tail 1 26b12d17fefc
2017-07-03T13:58:54.232003809Z nohup: appending output to 'nohup.out'
$ docker logs --since 30m 26b12d17fefc
nohup: appending output to 'nohup.out'
$ docker logs -t --since="2017-07-03T13:58:54.232003809Z" 26b12d17fefc
2017-07-03T13:58:54.232003809Z nohup: appending output to 'nohup.out'
$ docker logs -t --since="2017-07-03T12:12:29.909710295Z" 26b12d17fefc
2017-07-03T12:12:29.909710295Z nohup: appending output to 'nohup.out'
2017-07-03T13:58:54.232003809Z nohup: appending output to 'nohup.out'
对应qq群号:616961231
今日