mirror of
https://github.com/yeasy/docker_practice.git
synced 2025-08-04 06:51:42 +00:00
Add debug skills
This commit is contained in:
34
appendix/debug.md
Normal file
34
appendix/debug.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# 如何调试 Docker
|
||||
|
||||
## 开启 Debug 模式
|
||||
|
||||
在 dockerd 配置文件 daemon.json(默认位于 /etc/docker/)中添加
|
||||
|
||||
```json
|
||||
{
|
||||
"debug": true
|
||||
}
|
||||
```
|
||||
|
||||
重启守护进程。
|
||||
|
||||
```bash
|
||||
$ sudo kill -SIGHUP $(pidof dockerd)
|
||||
```
|
||||
|
||||
此时 dockerd 会在日志中输入更多信息供分析。
|
||||
|
||||
## 检查内核日志
|
||||
|
||||
```bash
|
||||
$ sudo dmesag |grep dockerd
|
||||
$ sudo dmesag |grep runc
|
||||
```
|
||||
|
||||
## Docker 不响应时处理
|
||||
|
||||
可以杀死 dockerd 进程查看其堆栈调用情况。
|
||||
|
||||
```bash
|
||||
$ sudo kill -SIGUSR1 $(pidof dockerd)
|
||||
```
|
Reference in New Issue
Block a user