https://avatars.githubusercontent.com/u/6058558

程式狂想筆記

Docker時間同步(校正)

Docker 容器在建立時,預設使用的是 UTC 時間,對於台灣或其他非 UTC 時區的應用程式而言,日誌時間、資料庫時間戳記等可能會顯示不正確的時間。以下整理幾種修正 Docker 容器時間的方式。 問題確認 1 2 3 4 5 # 查看主機時間 date # 查看容器時間 docker exec -it <container_name> date 如果兩者不一致,就需要進行時區同步設定。 方法一:掛載主機的 localtime(推薦) 將主機的 /etc/localtime 掛載到容器內,容器就會使用主機的時區設定: 1 2 3 4 docker run -d \ -v /etc/localtime:/etc/localtime:ro \ -v /etc/timezone:/etc/timezone:ro \ your-image-name :ro 表示唯讀(read-only),避免容器意外修改主機設定。 方法二:設定 TZ 環境變數 透過設定 TZ 環境變數來指定容器的時區: 1 2 3 docker run -d \ -e TZ=Asia/Taipei \ your-image-name 或在 Dockerfile 中設定: 1 2 3 4 5 6 7 FROM ubuntu:20.

[Pietty]Vim不能貼上問題&換字體顏色

在使用 PieTTY(或其他 SSH 終端機)連線到 Raspberry Pi 後,有時會遇到 Vim 無法右鍵貼上的問題,以及終端機顯示的字體顏色(如深藍色)在黑色背景上看不清楚的問題。這篇筆記整理這兩個問題的原因與解決方式。

Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick Start Create a new post 1 $ hexo new "My New Post" More info: Writing Run server 1 $ hexo server More info: Server Generate static files 1 $ hexo generate More info: Generating