Skip to content

Commit 2e9d7e6

Browse files
committed
Document process for testing RunCVM within a RunCVM VM
1 parent 8ceee8f commit 2e9d7e6

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ RunCVM features:
163163
- [Advanced usage](#advanced-usage)
164164
- [Developing](#developing)
165165
- [Building](#building)
166+
- [Testing](#testing)
166167
- [Contributing](#contributing)
167168
- [Support](#support)
168169
- [Uninstallation](#uninstallation)
@@ -636,6 +637,59 @@ The build script creates a Docker image named `newsnowlabs/runcvm:latest`.
636637

637638
Now follow the main [installation instructions](#installation) to install your built RunCVM from the Docker image.
638639

640+
## Testing
641+
642+
Test RunCVM using nested RunCVM. You can do this using a Docker image capable of installing RunCVM, or an image built with a version of RunCVM preinstalled.
643+
644+
Build a suitable image as follows:
645+
646+
```sh
647+
cat <<EOF | docker build --tag=ubuntu-docker-runcvm -
648+
FROM ubuntu:jammy
649+
650+
# Install needed packages and create and configure 'runcvm' user account
651+
RUN apt update && \
652+
apt -y install \
653+
apt-utils kmod wget iproute2 systemd \
654+
ca-certificates curl gnupg udev dbus sudo psmisc && \
655+
curl -fsSL https://get.docker.com | bash && \
656+
echo kvm_intel >>/etc/modules && \
657+
useradd --create-home --shell /bin/bash --groups sudo,docker runcvm && \
658+
echo runcvm:runcvm | chpasswd && \
659+
echo 'runcvm ALL=(ALL) NOPASSWD: ALL' >/etc/sudoers.d/runcvm
660+
661+
WORKDIR /home/runcvm
662+
ENTRYPOINT ["/lib/systemd/systemd"]
663+
VOLUME /disks
664+
665+
# Mount formatted backing file at /var/lib/docker for speed and overlay2 support
666+
ENV RUNCVM_DISKS='/disks/docker,/var/lib/docker,ext4,2G'
667+
668+
# # Uncomment this block to preinstall RunCVM from the specified image
669+
#
670+
# COPY --from=newsnowlabs/runcvm:latest /opt /opt/
671+
# RUN rm -f /etc/init.d/docker && \
672+
# bash /opt/runcvm/scripts/runcvm-install-runtime.sh --no-dockerd
673+
EOF
674+
```
675+
676+
(Uncomment the final block to build an image with RunCVM preinstalled, or leave the block commented to test RunCVM installation).
677+
678+
To launch, run:
679+
680+
```sh
681+
docker run -d --runtime=runcvm -m 2g --name=ubuntu-docker-runcvm ubuntu-docker-runcvm
682+
```
683+
684+
> Optionally modify this `docker run` command by:
685+
> - adding `--rm` - to automatically remove the container after systemd shutdown
686+
> - removing `-d` and adding `--env=RUNCVM_KERNEL_DEBUG=1` - to see kernel and systemd boot logs
687+
> - removing `-d` and adding `-it` - to provide a console
688+
689+
Then `docker exec -it -u runcvm ubuntu-docker-runcvm bash` to obtain a command prompt and perform testing.
690+
691+
Run `docker rm -fv ubuntu-docker-runcvm` to clean up after testing.
692+
639693
## Support
640694

641695
**Support launching images:** If you encounter any Docker image that launches in a standard container runtime that does not launch in RunCVM, or launches but with unexpected behaviour, please [raise an issue](https://github.com/newsnowlabs/runcvm/issues) titled _Launch failure for image `<image>`_ or _Unexpected behaviour for image `<image>`_ and include log excerpts and an explanation of the failure, or expected and unexpected behaviour.

0 commit comments

Comments
 (0)