Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create docker image from an ISO file?

I wanna create a docker image from an ISO file. and I meet the same question like this iso to docker file

I did same operations with him , and I know it's wrong now.

now what i have is:

  • an ISO file. my own ISO file, based on ubuntu but it's not ubuntu.
  • a computer, running ubuntu on it.

and I wanna know the detail operations to create a docker image from this ISO file.

if use VM, I hope i could get certainly operations. or if don't need VM, what should I do ?

I have searched many docs... like make a qcow2 from iso file, like debootstrap .. but these docs are not quite clearly and confused me a lot ...

I really wanna know detail operations, like this:

sudo mount -o loop CentOS-6.4-x86_64-minimal.iso /media/cdrom

sudo tar -C /media/cdrom -c . | docker import - flores314/centos2:new

although it is wrong, but it is clear.

If it is not clear, it will really really confused people like me ...

Thanks !!!

like image 350
李浩然 Avatar asked Feb 22 '17 07:02

李浩然


People also ask

Can I create a docker image from ISO?

Finally, we can compress and import the image using Docker. Where IMAGENAME is the name you want to give the image and TAG is a tag for the image. When the process completes, you'll see an sha256 hash for the image printed out. And that's all there is to creating your own Docker images from downloaded ISOs.

Can I create my own docker image?

Create a Docker image from an existing container: In this case, you start with an existing image, customize it with the changes you want, then build a new image from it. Use a Dockerfile: In this case, you use a file of instructions -- the Dockerfile -- to specify the base image and the changes you want to make to it.

How do I create a docker image from an existing image?

You can create a new image by using docker command $docker build -f docker_filename . , It will first read the Dockerfile where the instructions are written and automatically build the image. The instruction in the Dockerfile contains the necessary commands to assemble an image.


2 Answers

docker import can make your work easy. I found a useful article for this https://medium.com/@SofianeHamlaoui/convert-iso-images-to-docker-images-4e1b1b637d75

like image 127
Abhinav Sharma Avatar answered Oct 02 '22 05:10

Abhinav Sharma


Basically, converting an ISO to a docker container, is something you can't do verbatim. This is because one is a disk image, where the other is a complete container that also includes a filesystem.

It is possible though to create a new container, mount the iso and copy the contents into the FileSystem. I'm not sure if you're going to find anyone here who will write a list of commands that you should run to achieve this. If you start trying though and explain what you are doing and what problems you are running into, you will find that the people here are more than helpfull!

like image 32
J. Meijers Avatar answered Oct 02 '22 05:10

J. Meijers