GithubHelp home page GithubHelp logo

sheng-liang / vm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rancher/old-vm

0.0 1.0 0.0 183 KB

Package and Run Virtual Machines as Docker Containers

License: Apache License 2.0

Makefile 11.36% Shell 15.36% CSS 6.61% Python 65.33% HTML 1.34%

vm's Introduction

RancherVM

Package and run KVM images as Docker containers

How It Works

RancherVM allows you to create a special kind of containers called VM Containers. A VM container looks and feels like a regular container. It can be created from Dockerfile, distributed using DockerHub, managed using docker command line, and networked together using links and port bindings. Inside each VM container, however, is a virtual machine instance. You can package any QEMU/KVM image as RancherVM containers.

RancherVM additionally comes with a management container that provides a web UI for managing virtual machines and accessing the VNC console.

How it works

Run

First, ensure Docker and KVM are both installed on your system. Follow the distribution-specific instructions to ensure KVM works. We only require KVM to be enabled in the kernel. We do not need any user space tools like qemu-kvm or libvirt. On Ubuntu 14.04, you can make sure KVM is enabled by checking that both devices /dev/kvm and /dev/net/tun exist.

You can run RancherVM on RancherOS. If you are running RancherOS 0.3.1 or later, KVM is already enabled in the kernel.

An easy way to run KVM on your Windows or Mac laptop is to use nested virtualization with VMware Workstation or VMware Fusion. Just enable "Virtualize Intel VT-x/EPT or AMD-V/RVI" in VM settings.

Once you have Docker and KVM both setup, run:

docker run -v /var/run:/var/run -p 8080:80 -v /tmp/ranchervm:/ranchervm rancher/ranchervm

and point your browser to https://<KVM hostname>:8080

You can create VM containers through the web UI or create them directly using Docker command line as follows:

docker run -e "RANCHER_VM=true" --cap-add NET_ADMIN -v \
    /tmp/ranchervm:/ranchervm --device /dev/kvm:/dev/kvm \
    --device /dev/net/tun:/dev/net/tun rancher/vm-rancheros

When you run a VM container from the command line, the system prints a path to a Unix socket for VNC console access.

RancherVM collects the command line options to docker run command and pass them to kvm command. For example, the following command creates the exact same RancherOS VM and additionally specifies memory size and virtual CPU count.

docker run -e "RANCHER_VM=true" --cap-add NET_ADMIN -v \
    /tmp/ranchervm:/ranchervm --device /dev/kvm:/dev/kvm \
    --device /dev/net/tun:/dev/net/tun rancher/vm-rancheros -m 1024m -smp 1

Rancher creates 2 IP addresses in the container and that confuses the RancherVM startup script. You need to set the environment variable IP_PREFIX=10.42 to get RancherVM to work under Rancher.

All the core capabilities of RancherVM reside in the VM container. The RancherVM management container (rancher/ranchervm) provides a simple web interface built on the standard Docker API and is not an essential component of the system.

Build VM Images

You can find instructions on how to build images, including Windows images, in the RancherVM Images document.

Networking

The details of how RancherVM configures network for the VM container is documented in RancherVM Networking.

Build from Source

Just type make

RancherVM uses a modified version of noVNC at https://github.com/rancher/noVNC.

vm's People

Contributors

sheng-liang avatar ibuildthecloud avatar sebgoa avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.