Docker Community Forums

Share and learn in the Docker community.

Docker - ISO Mounting to Container - Ubuntu Server Full Image


(Sp1br) #1

The below command is meant to mount an iso image into a docker container:

  • #!/bin/bash
  • mount -o loop,ro ubuntu-16.04.4-server-amd64.iso /tmp/iso-mount
  • top_dir_mounts=()
  • for i in bin etc lib usr var
  • do
  • top_dir_mounts+=(-v “/tmp/iso-mount/$i:/$i”)
  • done
  • docker run --rm “${top_dir_mounts[@]}” --tmpfs /tmp --tmpfs /run routers_17418

OS Version/build
Ubuntu 16.04 4.13.0-38-generic

What I what to do is to mount an iso image of a ubuntu server, as I require a full ubuntu image within a container.

Any Help?

Thank you

(David Maze) #2

If you really require a full OS – init system, desktop environment, and all – it sounds like you’re looking for more like a standard virtualization system. VirtualBox is a straightforward option that runs on most mainstream operating systems.

When you start saying “ISO image” and “mount into a container” you’ve gotten well outside the space Docker is good at. I’d recommend reading Docker’s official tutorial on building and using custom images. If this doesn’t sound like something you could readily adapt for your use case then I’d focus more on full virtualization solutions.

I’d suggest:

  • Docker is good when you control your application’s build system; you have simple TCP-based (often HTTP) services; communication between services is only over the network, not shared files; you don’t need much from your OS beyond a language runtime

  • VMs are good when you need to run multiple components with shared filesystem state; you need a complex network topology; your application needs complex OS interactions like mounting filesystems or a local service bus

  • Host applications are good for software developers; when you need to directly manage the host; when you need access to the host’s hardware devices; for interactive desktop applications