Categorygithub.com/govm-project/govm
repositorypackage
0.0.0-20240410193255-f4dd720278d7
Repository: https://github.com/govm-project/govm.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

GoVM Project

Build Status Go Report Card codecov FOSSA Status

govm is a Docker-based tool that will launch your pet VM inside docker containers. It will use Docker networking layer and will map it to your VM.

Key Features

  • Uses Docker networking
  • Cloud Init support
  • Copy-on-write images
  • EFI support
  • Cloud-Init and RAW images support
  • Multi-Instances Compose
  • Custom hypervisor-level and qemu flags

The only Requirement

  • Docker

Quick Install (GNU/Linux based distribution)

  1. Download the latest govm release from https://github.com/govm-project/govm/releases/latest
  2. Install it
tar -xzvf govm_<latest_govm_release>_linux_amd64.tar.gz
sudo cp govm /usr/local/bin/
export PATH=/usr/local/bin/:$PATH
  1. Done, you're ready to go.

Build your own govm

Build Requirements

  • Go 1.11+
export GO111MODULE=on
mkdir -p $GOPATH/src/github.com/govm-project/
cd $GOPATH/src/github.com/govm-project/
git clone https://github.com/govm-project/govm.git
cd govm/
go build -o govm

Launch your first VM (Ubuntu 20.04 cloud image)

  • Download Ubuntu 20.04 cloud image
$ curl -Ok https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
  • Launch your VM
$ govm create --image focal-server-cloudimg-amd64.img --cloud
  • Login into the VM
# You may need to wait some seconds to let the machine boot and be ready for ssh.
govm list
ssh [email protected]

Sub-commands

create

Creates a new Virtual Machine inside a privileged docker container.

FlagDescriptionRequired
--image valuePath to imageYes
--user-data valuePath to user data fileNo
--efiUse efi bootloaderNo
--cloudCreate config-drive for cloud imagesNo
--flavor valueVM specs descriptorYes
--key valueSSH key to be included in a cloud imageNo
--name valueVM nameNo
--namespace valueVM namespace (this will normally be the user's username)No
--cpumodel valueModel of the virtual cpu. See: qemu-system-x86_64 -cpu helpNo
--sockets valueNumber of sockets. (default: 1)No
--cpus valueNumber of cpus (default: 1)No
--cores valueNumber of cores (default: 2)No
--threads valueNumber of threads (default: 2)No
--ram valueAllocated RAM (default: 1024)No
--debugDebug modeNo

remove

Removes the whole privileged docker container and its virtual machine data.

FlagDescriptionRequired
valueIf the value (name of container) is specified, it will remove it. See: govm list to get nameYes
--allRemoves all govm created virtual machinesNo

start

Starts a stopped GoVM Instance

FlagDescriptionRequired
valueGoVM instance's name or IDYes

list

Lists all virtual machines that were created with the govm tool. It also shows the VNC access url and name.

FlagDescriptionRequired
--allShow VMs from all namespacesNo
--namespace valueShow VMs from the given namespaceNo
--format value, -f valueString containing the template code to executeNo

Output example

$ govm list
ID         Name                   Namespace IP
b9b5d3a288 test-14731             onmunoz   172.17.0.6
4d6731b571 test-29652             onmunoz   172.17.0.5
ef004385d4 test-20024             onmunoz   172.17.0.4
5e5f42047b happy-poitras          onmunoz   172.17.0.3
e90608db45 wonderful-varahamihira onmunoz   172.17.0.2

Filtered output

$ govm list -f '{{select (filterRegexp . "Name" "test-*") "IP"}}'
172.17.0.6
172.17.0.5
172.17.0.4

compose

Deploys one or multiple virtual machines with a given compose template file.

FlagDescriptionRequired
-f valueTemplate fileYes

YAML template file example:

ssh

Connects through ssh to the specified virtual machine.

FlagDescriptionRequired
--user valuessh login userYes
--key valueprivate key path (default: ~/.ssh/id_rsa)No

save

Saves a GoVM Instance

FlagDescriptionRequiredDefault
--stopVMStop the VM During the SnapshotNofalse
--out valuePath to backup fileNobackup.img

help

NAME:
   govm - Virtual Machines on top of Docker containers

USAGE:
   govm [global options] command [command options] [arguments...]

VERSION:
   0.0.0

COMMANDS:
   create, c                Create a new VM
   list, ls                 List VMs
   remove, delete, rm, del  Remove VMs
   start, up, s             Start a GoVM Instance
   compose, co              Deploy VMs from a compose config file
   ssh                      ssh into a running VM
   stop, down, d            Stop a GoVM Instance
   save, snapshot           Save a GoVM Instance
   help, h                  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --workdir value  Alternate working directory. Default: ~/govm
   --help, -h       show help
   --version, -v    print the version

More cloud init stuff?

If you want to boot cloud images, edit the template files under $HOME/govm/cloud-init/openstack/latest/ to fit your own needs and use the --cloud flag. For more information, please see the cloud-init documentation: https://cloudinit.readthedocs.io/en/latest/

based on https://github.com/BBVA/kvm

Questions, issues or suggestions

http://github.com/govm-project/govm/issues

License

FOSSA Status