Unable to run docker image created from ISO

2019-05-24 20:58发布

问题:

Here i am trying to create docker image from ubuntu 14.04 ISO file, knowing ubuntu 14.04 is already available in docker hub. Because later i have to create docker images for Suse10 and Suse11[sp1 64bit] which is not available in docker hub.

I was able to create docker image from ubuntu 14.04 ISO with below commands

# mkdir rootfs
# mount -o loop /path/to/iso rootfs
# tar -C rootfs -c . | docker import - newubuntu

With above image gets successfully created , i can do docker images it gets listed

root@ubuntu:~# docker images

REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE

newubuntu latest 1dcd1b632d37 5 days ago 1.015 GB

But when i try to run image, then i get below error message

root@ubuntu:~# docker run -t -i newubuntu /bin/bash

2015/03/11 06:59:16 exec: "/bin/bash": stat /bin/bash: no such file or directory

Please kindly let me know how to resolve this error. I should be able to create container from that image and install other applications.

回答1:

You're building an image from ubuntu's iso but what you really want is building an image from an ubuntu install.

What you have to do is :

  • install ubuntu from the iso inside a VM

  • make an archive or the VM's /

  • import with docker

I hope that helps



回答2:

Use debootstrap to install a base image (you may include and exclude packages) into a directory that is chrootable.

You can use that directory to create the base image.