2021-12-27

executing "service libvirtd start" from ubuntu:20.04 container in docker results in libvirtd: unrecognized service [duplicate]

Steps taken:

Created a Dockerfile:

FROM ubuntu:20.04
ENV TZ=Europe/Amsterdam
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update -y
RUN apt-get install -y build-essential
RUN apt-get install -y qemu-kvm libvirt-daemon-system libvirt-dev
COPY startup.sh /
ENTRYPOINT ["/startup.sh"]

Created startup.sh:

#!/bin/bash
set -eou pipefail

chown root:kvm /dev/kvm
service libvirtd start
service virtlogd start

exec "$@"

Then make it executable and create a docker image build:

chmod +x startup.sh
docker build -t win10-vm:latest -f Dockerfile .

And last running a container from the image:

docker run --privileged -it --name temp-container1 --device=/dev/kvm --device=/dev/net/tun -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cap-add=NET_ADMIN --cap-add=SYS_ADMIN win10-vm:latest bash

Unfortunately when getting to the rule >> service libvirtd start in startup.sh then I'm getting the following error:

  • libvirtd: unrecognized service

Can someone help me to understand or tell me why the libvirtd service is not recognized. Specifically in ubuntu:20.04? Because when I do exactly the same in ubuntu:18.04 then libvirtd is recognized and starts with [OK]



from Recent Questions - Stack Overflow https://ift.tt/310SazR
https://ift.tt/eA8V8J

No comments:

Post a Comment