m-bers / docker-virt-manager

Docker virt-manager
GNU General Public License v3.0
124 stars 27 forks source link

Unable to connect #2

Closed ozboss closed 3 years ago

ozboss commented 3 years ago

Unfortunately I am unable to connect, I get following error message:

Unable to connect to libvirt qemu://root@<192.168.1.48/system.
Cannot read CA certificate '/etc/pki/CA/cacert.pem': No such file or directory
Verify that the 'libvirtd' deamon is running on the remote host.

Running systemctl status libvirtd shows that it is active. Any ideas?

m-bers commented 3 years ago

@ozboss qemu:// is not a valid connection string prefix, you need to do qemu+ssh:/// (note the three slashes). There's more info on this error here https://wiki.libvirt.org/page/Failed_to_connect_to_the_hypervisor#Cannot_read_CA_certificate

You don't have to use qemu+ssh:/// if you want to use another connection URI format. This should also work with everything listed here: https://libvirt.org/uri.html

If you want to use qemu:///system to connect to the same host you are running docker from (provided libvirtd is installed and running on the host), you can use the below compose file

version: '3.6'

services: 
  virt-manager:
    image: mber5/virt-manager:latest
    restart: always
    ports:
      - 8185:80
    devices:
      - "/dev/kvm:/dev/kvm"
    environment:
      HOSTS: "['qemu:///system']"
    volumes:
      - "/var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock"
      - "/var/lib/libvirt/images:/var/lib/libvirt/images"
ozboss commented 3 years ago

Yes sorry I actually tried with "qemu+ssh" must have miss spelled there. The problem was that I was trying to connect per SSH to the host with the key of the host bind mounted ... which is not so clever now that I think about it ...

So the compose file with the bind mount of the libvirt sock was what I was actually looking for :) Maybe add that to the README. Thank you and great container 👍