mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-03-11 04:14:38 +00:00
chore: remove unused historic image files
This commit is contained in:
@@ -31,6 +31,7 @@ CMD ["node", "server.js"]
|
||||
```
|
||||
|
||||
**优点**:
|
||||
|
||||
- 直接执行指定程序,是容器的 PID 1
|
||||
- 正确接收信号 (如 SIGTERM)
|
||||
- 无需 shell 解析
|
||||
@@ -62,6 +63,8 @@ CMD ["sh", "-c", "echo $HOME"]
|
||||
|
||||
### exec 格式 vs shell 格式
|
||||
|
||||
相关信息如下表:
|
||||
|
||||
| 特性 | exec 格式 | shell 格式 |
|
||||
|------|----------|-----------|
|
||||
| 主进程 | 指定的程序 | `/bin/sh` |
|
||||
@@ -163,6 +166,8 @@ CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
### CMD vs ENTRYPOINT
|
||||
|
||||
相关信息如下表:
|
||||
|
||||
| 指令 | 用途 | 运行时行为 |
|
||||
|------|------|-----------|
|
||||
| **CMD**| 默认命令 | `docker run` 参数会**覆盖**它 |
|
||||
|
||||
Reference in New Issue
Block a user