I am trying to use kvm with docker as a non root user. But I am not able to change the ownership and permission to the /dev/kvm. I need to use qemu kvm through docker. I am new to docker so help me to resolve this issue.
Inside docker I have created a user and trying to give kvm group ownership to the new user, but inside docker shell if I check ownership and permission to /dev/kvm, it’s not getting changed.
I was able to change the ownership to /dev/kvm through root user. I was also able to change the root user group to kvm group. But in case of non-root user I am not able to change the ownership and permission. Because of this I am not able to use kvm virtualization through docker.
Please find my Dockerfile and start.sh:
LABEL maintainer "Deepak Singh email@example.com
RUN apt-get update && apt-get install -y
RUN useradd -ms /bin/bash newuser
COPY ./start.sh /start.sh
set -o pipefail
gpasswd -a newuser kvm
chown newuser:kvm /dev/kvm