How to create a Docker image by downloading an ISO using Packer?

It is possible to create images from scratch using Packer by downloading an ISO from the internet.

Aim: to create Docker images by downloading an ISO using Packer

Attempts

Attempt 1

It is possible to import a Docker image

[username@hostname]$ cat docker.json 
{
    "builders":[{
        "type": "docker",
        "image": "ubuntu",
        "export_path": "image.tar"
    }]
}

using 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

Attempt 2

Changing the builder type of a packer.json that is used to create a virtualbox image to docker results in:

[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"

Problem

However, if a docker image needs to be created several base images could be downloaded, but is it also possible to download an ISO and to transform that to a docker image?


Reference

Basic Example: Export

enter image description here

Yes, it is possible to bootstrap your own images. Check the mkimage-* scripts from the contrib directory.