=================
== The Archive ==
=================

[Docker ๐Ÿณ] Container ๋กœ๊ทธ ๊ฐ€์ ธ์˜ค๊ธฐ

|

์ตœ๊ทผ AWS EC2 ๋ฅผ ์‚ฌ์ด๋“œ ํ”„๋กœ์ ํŠธ์— ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋ฉด์„œ, ๋กœ๊ทธ๋ฅผ ํ™•์ธํ•  ์ผ์ด ์ƒ๊ฒผ๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ํ„ฐ๋ฏธ๋„์—์„œ ssh ๋กœ EC2 ์— ์ ‘์†ํ•˜๋‹ค๋ณด๋‹ˆ, ๋กœ๊ทธ๋ฅผ tui ๋กœ ๋ด์•ผํ•˜๋Š”๊ฒŒ ์•„๋‹Œ๊ฐ€?

๊ธฐ์กด์— ๋กœ๊ทธ๋ฅผ ํŒŒ์•…ํ•˜๋Š” tail -f ์ฒ˜๋Ÿผ docker cli ์—๋„ ๋น„์Šทํ•œ๊ฒŒ ์žˆ๋Š”์ง€ ์ฐพ์•„๋ดค๊ณ , ์กด์žฌํ–ˆ๋‹ค.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
[ec2-user@server ~]$ docker logs -f --tail 10 {{container-name}}
This generated password is for development use only. Your security configuration must be updated before running your application in production.

2023-09-10T03:22:14.481+09:00  INFO 1 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 1 endpoint(s) beneath base path '/actuator'
2023-09-10T03:22:14.601+09:00  INFO 1 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Will secure any request with [~~~]
2023-09-10T03:22:16.289+09:00  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-09-10T03:22:16.340+09:00  INFO 1 --- [           main] m.z.ServerApplicationKt                  : Started ServerApplicationKt in 14.852 seconds (process running for 16.395)
2023-09-10T03:22:25.913+09:00  INFO 1 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-09-10T03:22:25.917+09:00  INFO 1 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2023-09-10T03:22:25.928+09:00  INFO 1 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 9 ms
2023-09-10T03:23:50.857+09:00  INFO 1 --- [nio-8080-exec-6] o.springdoc.api.AbstractOpenApiResource  : Init duration for springdoc-openapi is: 2049 ms

๋‹ค๋ฅธ ์˜ต์…˜์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

OptionShortDefaultDescription
--detailsfalseShow extra details provided to logs
--follow-ffalseFollow log output
--sinceShow logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)
--tail-nallNumber of lines to show from the end of the logs
--timestamps-tfalseShow timestamps
--untilAPI 1.35+ Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)

References

Categories:

Tags: