> For the complete documentation index, see [llms.txt](https://kennethfan.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kennethfan.gitbook.io/notes/docker/cha-kan-image-dui-ying-de-dockerfile.md).

# 查看image对应的dockerfile

```bash
docker history --format {{.CreatedBy}} --no-trunc=true <镜像id> | sed '1!G;h;$!d'
```

也可以写个shell脚本

```bash
#!/bin/bash


if [ $# -lt 1 ]; then
	echo "Usage $0 <image>"
	exit
fi


docker history --format {{.CreatedBy}} --no-trunc=true $1 | sed '1!G;h;$!d'
```
