Upgrade to Pro — share decks privately, control downloads, hide ads and more …

docker logs -f

docker logs -f

tail -f で流れてくるログを見るのが大好きです

Tori Hara

March 05, 2016
Tweet

More Decks by Tori Hara

Other Decks in Technology

Transcript

  1. $ docker logs -f gulp [13:58:04] Using gulpfile /app/gulpfile.js [13:58:04]

    Starting 'default'... ひと昔前の開発環境ログ その1
  2. $ cat Procfile web: docker logs -f web api: docker

    logs -f api ひと昔前の開発環境ログ その2 https://github.com/ddollar/forego $ cat Procfile web: docker logs -f web api: docker logs -f api $ ./forego start | grep 'error' web.1 | 2016/03/03 15:25:35 [error] 19997#0: *1 open() "/var/www/ html/something.php" failed (2: No such file or directory), client: 192.168.8.1, server: localhost, request: "GET /something.php HTTP/1.1", host: "www.example.com" api.1 | ERROR: 2016/03/04 13:57:59[service] Failed to fetch some data
  3. $ docker-compose logs Attaching to db, gulp, api, web gulp

    | [13:58:04] Using gulpfile /app/gulpfile.js api | INFO: 2016/03/04 13:57:59[service] listening on port 9000 db | 2016-03-04 13:58:05 mysqld (mysqld 5.6.29) starting as process 1 ... web | INFO: 2016/03/04 13:59:59 [192.168.99.1:65446] 200 GET / 0.645 web | INFO: 2016/03/04 13:59:59 [192.168.99.1:65446] 200 GET / 0.645 開発環境の Docker ログ $ docker-compose logs | grep 'error' web | 2016/03/03 15:25:35 [error] 19#0: *1 open() "/app/ something.php" failed (2: No such file or directory), client: 192.168.8.1, server: localhost, request: "GET /something.php HTTP/1.1", host: "www.example.com" api | ERROR: 2016/03/04 13:57:59[service] Failed to fetch some data
  4. $ docker-compose logs Attaching to db, gulp, api, web gulp

    | [13:58:04] Using gulpfile /ap gulpfile.js api | INFO: 2 list 本番環境で͸ʁ
  5. logging-driver $ docker run -d -p 80:80 \ --log-driver=fluentd \

    --log-opt fluentd-address=fluentd.host:24224 \ --log-opt tag=docker.{{.Name}} \ my/web