Docker Community Forums

Share and learn in the Docker community.

Unable to change ownership and permission to /dev/kvm through docker


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

My Dockerfile:

FROM ubuntu:16.04
LABEL maintainer "Deepak Singh

RUN apt-get update && apt-get install -y

RUN useradd -ms /bin/bash newuser

USER newuser
WORKDIR /home/newuser

COPY ./ /


CMD ["/bin/bash/qemu-system-x86_64"]

" file:


set -e
set -o pipefail

gpasswd -a newuser kvm
chown newuser:kvm /dev/kvm
exec $@