有系統程式 crash,但還沒到 panic 程度。
crash 回報檔存在 /var/crash 目錄,可移除。
編輯 /etc/default/apport 可關閉 Apport。
參考
有系統程式 crash,但還沒到 panic 程度。
crash 回報檔存在 /var/crash 目錄,可移除。
編輯 /etc/default/apport 可關閉 Apport。
參考
Docker 實作輕量級的作業系統虛擬化解決方案,以 Linux 容器 (LXC) 等技術為基礎,進一步封裝讓使用者不需要去關心容器的管理,使得操作更為簡便。Docker 最初是 dotCloud 公司內部的一個業餘專案,採用 Google 的 Go 語言實作。專案後來加入了 Linux 基金會,以 Apache 2.0 開源。
Docker get started:
scan images for security vulnerabilities.
安裝 Docker (精確地講 Docker Engine):在 Linux 稱 Server,在 macOS/Widnows 稱 Desktop。
Docker Desktop for Linux 會在虛擬電腦下執行,不同於先前的 Linux Docker Engine,images 和 containers 也不適用。
參考
支援 x86_64/amd64、armhf、和 arm64 架構。
Docker Engine 是一個 client-server 應用,包括
透過 Docker REST API 溝通。
支援 overlay2、aufs、和 btrfs storage drivers。預設使用 overlay2,如果要用 aufs 需要手動設定。
安裝方式
會建立 docker 群組,但無使用者,需要 sudo 執行 docker 指令。
執行 hello-world image 驗證安裝成功。
sudo docker run hello-world
顯示下列訊息後結束
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:df5f5184104426b65967e016ff2ac0bfcd44ad7899ca3bbcf8e44e4461491a9e
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
dockerd 以 root 身份執行,bind to 一個 Unix socket,需要 sudo 才能存取。加入 socker 群組的使用者可免除 sudo。Continue to Linux postinstall to allow non-privileged users to run Docker commands and for other optional configuration steps.
注意安全問題:執行 container 隱含執行 dockerd,只能開給信任的使用者。host 的目錄可共享給 container,例如 host 的 / 目錄,於是 container 可以沒有限制地更動。透過網路存取也要小心,需要加密或限制網域。
自動啟動 dockerd
設定檔:docker.service, containerd.service
參考
「containers are only isolated groups of processes running on a single host, which fulfill a set of “common” features」
historical beginning
chroot:改變 process 的 root directory。
Linux Namespaces
mnt:不共享掛載的檔案系統
uts (UNIX Time-sharing System):不共享 domainname 和 hostname
ipc:隔離 IPC 資源,也就是 System V IPC objects 和 POSIX message queues。
pid (Process ID):讓 process 在 host 有 PID 外,在 namespace 下有另一組 PID,且可以 nested。在 namespace 內,第 1 個 process 的 PID 是 1,和一般 init process 相同特殊對待,所有 namespace 內 processe 都 re-parented 於 namespace 的 PID 1,結束 PID 1 也結束 namespace 內所有 processe。
net (Network) namespace 用來 virtualize the network stack,每個 network namespace contains its own resource properties within /proc/net. 一開始,一個 network namespace 只有 loopback 界面。每個網路界面只會在一個 namespace 出現,可以移到不同 namespace。每個 namespace 有自己的 IP 位址、routing table、socket listing、connection tracking table、firewall、和其它網路相關資源。刪除 network namespace 會刪除 virtual 界面,physical 界面會回到原本的 network namespace。
user (User ID):讓 process 在 namespace 內有另一套 user ID 和 group ID。unprivileged user ID 的 process 在 namespace 內可以是 privileged。
cgroup (Control Group) 支援 resource limiting, prioritization, accounting and controlling。
Composing Namespaces
Demo Application
2008 發明 cgroup,出現 Linux Containers (LXC) 計畫結合 cgroup 和 namespace 提供執行應用程式的獨立環境。同時,2007 Google 開始稱為 Let Me Contain That For You (LMCTFY) 的 containerization project, 設法提供一個穩定 API 驅動的設定方式,不用了解 cgroup 和內部細節。2013 Docker 基於 LXC,包裝 container 成為 image 而可以在機器間轉移,首先讓 container 成為標準軟體單元。之後一起發展 libcontainer,採用 Go 原生方式 spawn and manage containers。2015,計畫類似 Kubernetes 到 v1.0,成立 CNCF 推行 container,成立 Open Container Initiative (OCI) 致力於建立 container 格式的標準 -- OCI Runtime Specification。libcontainer 捐給 OCI,也誕生 runc 工具直接和 libcontainer 互動、解釋 OCI Runtime Specification 並執行。runc 用在許多 container ecosystem,如 containerd (used by Docker), CRI-O and podman。也有其它計畫採用 OCI Runtime Specification,如 Kata Containers 可以建立和執行包含輕量虛擬機器的 secure containers,用硬體 virtualization 技術作為第二層 defense 提供更強大的 workload 隔離。
參考
logger [OPTIONS] [MESSAGE]
寫 MESSAGE 或標準輸入到 syslog
選項
範例
參考
syslogd [選項]
選項
功能 ROTATE_LOGFILE
功能 REMOTE_LOG
功能 SYSLOGD_DUP
功能 IPC_SYSLOG
功能 SYSLOGD_CFG
範例
syslogd 動作
本地紀錄的動作
參考
SIP 的 Private Header (P-Header) 擴充
P-Associated-URI = "P-Associated-URI" HCOLON
[p-aso-uri-spec]
*(COMMA p-aso-uri-spec)
p-aso-uri-spec = name-addr *(SEMI ai-param)
ai-param = generic-param範例 [https://community.cisco.com/t5/ip-telephony-and-phones/cisco-2811-itsp-sip-configuration-was-good-from-a-long-time-but/m-p/4163078]P-Associated-URI: <sip:+97440006999@vodafone.qa> P-Associated-URI: <tel:+97440006999> P-Associated-URI: <tel:+97440006900;wcard-range=+974400069![0-9][0-9]!> P-Associated-URI: <sip:+974400069![0-9][0-9]!@vodafone.qa>name-addr 的 URI 是 <> 包起來的,其中 user 或 telephone-subscriber 的 wildcard 支援
Early Media 授權 [https://datatracker.ietf.org/doc/html/rfc5009]
所有 SIP 訊息 都要有 Via,縮寫 v。一開始的 UAC 和後續途經的每個 proxy 都會疊加一個 Via 放傳送的位址,依序作為回應的路徑。 格式 sent-protocol sent-by [ ;branch= branch ][ ; 參數 ...] s...