Skip to content

Commit

Permalink
add description of the new build process
Browse files Browse the repository at this point in the history
  • Loading branch information
stlankes committed Oct 8, 2024
1 parent df12e2e commit b3a79b6
Showing 1 changed file with 12 additions and 38 deletions.
50 changes: 12 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,23 @@
# runh

`run` is a CLI tool for spawning and running RustyHermit containers.
To start RustyHermit application within a isolated lightweight virtual machine, a directory with the application and the loader must be created.
In this example, the binaries will be downloaded from a docker registry.
`runh` is a CLI tool for spawning and running HermitOS containers.
To start HermitOS application within a isolated lightweight virtual machine, a container registry with the the HermitOS application and its loader.

At first, the required tools will be downloaded and installed to run RustyHermit images.
To create a container image with the httpd example from the [HermitOS](https://github.com/hermit-os/hermit-rs) repository, the following `Dockerfile` is used.
The example assumes, that `httpd` and `hermit-loader-x86_64` is already created and copied to the directory, which contains the `Dockerfile`.

```sh
$ docker export $(docker create ghcr.io/hermit-os/hermit_env:latest) > hermit-env.tar
$ sudo mkdir -p /run/runh/hermit
$ sudo tar -xf hermit-env.tar -C /run/runh/hermit
```

Afterwards, the RustyHermit application will be download and store in a local directory.

```sh
$ docker export $(docker create ghcr.io/hermit-os/rusty_demo:latest) > runh-image.tar
$ mkdir -p ./runh-image/rootfs
$ tar -xf runh-image.tar -C ./runh-image/rootfs
```

In this case, the application an the loader is stored in the subdirectory `runh-image/rootfs`.

```sh
$ ls ./runh-image/rootfs
drwxr-xr-x 1 stefan stefan 128 May 24 12:27 .
drwxr-xr-x 1 stefan stefan 96 May 24 12:27 ..
-rwxr-xr-x 1 stefan stefan 3651080 May 20 13:53 rusty_demo
-rwxr-xr-x 1 stefan stefan 2225868 May 19 22:50 hermit-loader
```

An OCI specification file is required to start the hypervisor within an isolated environment.
The following commands generate a starter bundle for `rusty_demo`, create and start the container:

```sh
$ cd runh-image
$ sudo runh --root /run/runh spec --bundle . --args /hermit/rusty_demo
$ sudo runh --root /run/runh -l debug create --bundle . runh-container
$ sudo runh --root /run/runh -l debug start runh-container
```Dockerfile
FROM ghcr.io/hermit-os/hermit_env:latest
COPY hermit-loader-x86_64 hermit/hermit-loader
COPY httpd hermit/httpd
CMD ["/hermit/httpd"]
```

After a successfull test, the container can be deleted with following command:
Afterwards, the container image can be created and pushed to the registry.
The registery tag has to replace with the enduser registry.

```sh
$ sudo runh --root /run/runh -l debug delete runh-container
$ docker buildx build --tag ghcr.io/hermit-os/httpd:latest --push .
```

## Funding
Expand Down

0 comments on commit b3a79b6

Please sign in to comment.