Manage KVM Virtual Machines using CLI Virsh

Description: virsh is a program which uses libvirt to manage KVM virtual machines (guests). I’m going to show a summary of its main functions (cheat sheet style):

Show guests’ information:

  • Show a list of all the defined guests: virsh list --all
  • Show a guest’s info: virsh dominfo guest's_name

Start and stop guests:

  • Start a guest: virsh start guest's_name
  • Shutdown a guest (gently): virsh shutdown guest's_name
  • Shutdown a guest (wild): virsh destroy guest's_name
  • Suspend a guest: virsh suspend guest's_name
  • Resume a suspended guest: virsh resume guest's_name

Create and modify guests:

  • Create a new guest
  • Create a guest from its XML definition: virsh create xml_file.xml
  • Dump a guest’s definition in XML: virsh dumpxml guest's_name
  • Modify a guest’s definition: virsh edit guest's_name
  • Remove a guest’s definition (it doesn’t remove the image file): virsh undefine guest's_name

Backup and restore guests:

  • Save a guest’s state on a file: virsh save guest's_name guest's_state_file
  • Restore a guest from a state file: virsh restore guest's_state_file


Freya Linux ISO






Debian Setting Up Docker Private Registry

$ sudo apt-get update
$ sudo apt-get install

$docker pull registry

$docker run –p 5000:5000 –d --name=private_registry registry

Once you have created the private registry, you need to connect it to it from client:

docker login YOUR_IP:5000

# Pull the debian image from the public registry

docker pull debian

# Tag it with our IP/URL

docker tag debian YOUR_IP:5000/debian

# Push it to our newly made registry

docker push YOUR_IP:5000/debian