通过从Internet下载ISO,可以使用Packer从头创build图像。
目标:通过使用Packer下载ISO来创buildDocker镜像
尝试
尝试1
可以导入一个Docker镜像
[username@hostname]$ cat docker.json { "builders":[{ "type": "docker", "image": "ubuntu", "export_path": "image.tar" }] }
使用Packer:
[username@hostname packer]$ packer build docker.json docker output will be in this color. ==> docker: Creating a temporary directory for sharing data... ==> docker: Pulling Docker image: ubuntu ==> docker: Starting docker container... ==> docker: Exporting the container ==> docker: Killing the container: 6e0e5488d8b4f97667123ea965a561c91122f3efc6ef4b86a7c40560714d6577 Build 'docker' finished. ==> Builds finished. The artifacts of successful builds are: --> docker: Exported Docker file: image.tar
尝试2
将用于创build虚拟机镜像的packer.json的构build器types更改为docker结果是:
[username@hostname]$ packer build docker-scratch.json docker output will be in this color. 15 error(s) occurred: * unknown configuration key: "boot_command" * unknown configuration key: "boot_wait" ... * unknown configuration key: "vboxmanage" * unknown configuration key: "virtualbox_version_file"
问题
但是,如果需要创build一个docker图像,可以下载几个基本图像,但是是否也可以下载ISO并将其转换为docker图像?
基本示例:导出
是的,有可能引导你自己的图像。 从contrib目录中检查mkimage-*脚本。