| command | 覆盖镜像 CMD |
|---|---|
| entrypoint | 覆盖镜像 ENTRYPOINT |
| 清空 | entrypoint: [] 后由 command 直接启动 |
示例
示例
services:
debug:
image: app/api:1.4.2
entrypoint: ["/bin/sh", "-c"]
command: ["sleep infinity"]
once:
image: app/api:1.4.2
entrypoint: []
command: ["/app/init-db"]列表形式避免 shell 解析问题;需要管道/变量替换时显式用 ["sh","-c","…"] 包一层。