13
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

dockerでKVM (ennweb/kvm)

Last updated at Posted at 2016-11-29

参考

win10の例

qemu-img create -f qcow2 20gb.qcow2 20G
docker-compose.yml
kvm:
  image: ennweb/kvm
  container_name: kvm
  privileged: true
  volumes:
    - .:/data/
  environment:
    - VNC=tcp
    - RAM=1024
    - SMP=1
    - IMAGE=/data/20gb.qcow2
    #- IMAGE_CREATE=1
    - ISO_DOWNLOAD=0
    - ISO=/data/Win10_1607_Japanese_x32.iso
    - ISO2=/data/virtio-win.iso
    - KEYBOARD=ja
  ports:
    - "5911:5900"
    - "127.0.0.1:2222:22"
  • 初期値 IMAGE_FORMAT qcow2

CD Bootしたい場合は - BOOT=once=d を追加。

virtioでwin10 32bitをインストール

virtio1.png
virtio2.png

接続方法(例)

vncviewer localhost:5900
ssh -p 2222 localhost

winxpでfddを使う例

xp.png

-e FLOPPY=/data/virtio-win-1.1.16.vfd \
-e BOOT=once=d \
-e KEYBOARD=ja \
-e DISK_DEVICE=ide \
docker run -d \
 --privileged \
 --restart=always \
 -p 5900:5900 \
 -p 3389:3389 \
 -v `pwd`:/data/ \
 -e VNC=tcp \
 -e RAM=512 \
 -e SMP=1 \
 -e IMAGE=/data/20gb.qcow2 \
 -e ISO_DOWNLOAD=0 \
 -e ISO=/data/xp.iso \
 -e FLOPPY=/data/virtio-win-1.1.16.vfd \
 -e BOOT=once=d \
 -e KEYBOARD=ja \
 -e DISK_DEVICE=ide \
 ennweb/kvm
docker-compose.yml
kvm:
  image: ennweb/kvm
  container_name: kvm
  privileged: true
  volumes:
    - .:/data/
  environment:
    - VNC=tcp
    - RAM=1024
    - SMP=2
    - IMAGE=/data/20gb.qcow2
    #- IMAGE_CREATE=1
    - ISO_DOWNLOAD=0
    - ISO=/data/xp.iso
    - FLOPPY=/data/virtio-win-1.1.16.vfd
    - BOOT=once=d
    - KEYBOARD=ja
    - DISK_DEVICE=ide

  ports:
    - "5900:5900"
    - "3389:3389"

dockerを使わない場合

qemu-img create -f qcow2 20gb.qcow2 20G
sudo kvm \
  -name xp -smp 2 -m 1000 \
  -vnc :0  \
  -vga qxl \
  -k ja \
  -cdrom xp.iso \
  -drive file="20gb.qcow2,if=virtio" \
  -fda "virtio-win-1.1.16.vfd" \
  -boot "once=d" \
  \
  -netdev type=tap,script=/etc/qemu-ifup,id=net0 \
  -device virtio-net-pci,netdev=net0 \
  -redir :3389::3389

bridge

/etc/qemu/bridge.conf
allow vmbr0
 -net nic -net bridge,br=vmbr0

dockerをubuntuにインストール

2017-06-19
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

sudo apt install -y docker-engine
13
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
16

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?