This repository was archived by the owner on Feb 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 193
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
dockerizing hyperd #595
Copy link
Copy link
Open
Description
I'd like to run hyperd inside a docker image for deployment reasons.
I've managed to get it working by adding lots of privileges (that is okay for my scenario):
$ docker run --privileged --net=host -v /dev:/dev --cap-add=ALL -it myimage bash
$ hyperd >/dev/null &
$ hyperctl run -t alpine:3.2 uptime
09:42:41 up ....
The hyperd prints out following errors:
WARN[0000] devmapper: Udev sync is not supported. This will lead to unexpected behavior, data loss and errors. For more information, see https://docs.docker.com/reference/commandline/daemon/#daemon-storage-driver-option
WARN[0000] devmapper: Usage of loopback devices is strongly discouraged for production use. Please use `--storage-opt dm.thinpooldev` or use `man docker` to refer to dm.thinpooldev section.
WARN[0000] devmapper: XFS is not supported in your system. Either the kernel doesnt support it or mkfs.xfs is not in your PATH. Defaulting to ext4 filesystem
INFO[0000] devmapper: Creating filesystem ext4 on device docker-0:69-235-base
INFO[0001] devmapper: Successfully created filesystem ext4 on device docker-0:69-235-base
INFO[0001] Graph migration to content-addressability took 0.00 seconds
WARN[0001] Your kernel does not support swap memory limit.
INFO[0001] Loading containers: start.
INFO[0001] Loading containers: done.
E0406 09:43:16.823246 1 dm.go:193] losetup: /var/lib/hyper/lib/data: failed to set up loop device: Device or resource busy
My Dockerfile is as follows:
FROM ubuntu:16.04
ENV DEBIAN_FRONTEND=noninteractive
ENV GOPATH=/root/go
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y software-properties-common && \
add-apt-repository -y ppa:longsleep/golang-backports && \
apt-get update && \
apt-get install -y golang-1.8 && \
ln -s /usr/lib/go-1.8/bin/go /usr/local/bin/go
WORKDIR /root/go/src/github.com/hyperhq
RUN apt-get install -y git
RUN git clone https://github.com/hyperhq/hyperd.git hyperd && \
git clone https://github.com/hyperhq/hyperstart.git hyperstart
RUN apt-get install -y \
autotools-dev libdevmapper-dev libsqlite3-dev libvirt-dev automake \
cpio
WORKDIR /root/go/src/github.com/hyperhq/hyperd
#TODO: btrfs is yes, but:
#checking btrfs/ioctl.h, usability... no
#checking btrfs/ioctl.h, presence... no
#checking for btrfs/ioctl.h,... no
RUN apt-get install -y gawk btrfs-tools
RUN ./autogen.sh && \
./configure --without-xen && \
make
RUN cp hyperd /usr/local/bin && \
cp hyperctl /usr/local/bin && \
mkdir -p /etc/hyper && \
cp package/dist/etc/hyper/config /etc/hyper
WORKDIR /root/go/src/github.com/hyperhq/hyperstart
RUN ./autogen.sh && \
./configure && \
make
RUN mkdir -p /var/lib/hyper && \
cp build/kernel /var/lib/hyper && \
cp build/hyper-initrd.img /var/lib/hyper
RUN apt-get install -y \
aufs-tools libvirt-bin qemu-kvm
#TODO: move
#E0406 08:48:28.327679 16 dm.go:222] /bin/sh: 1: dmsetup: not found
RUN apt-get install -y dmsetup
# WARN[0001] Running modprobe nf_nat failed with message: `modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.0-66-generic/modules.dep.bin'
RUN apt-get install -y kmod
RUN apt-get install -y linux-image-4.4.0-66-generic
How could I get rid of those errors?