asterinas / hyperenclave

HyperEnclave is an open and cross-platform trusted execution environment.
Apache License 2.0
25 stars 4 forks source link

Questions about Images #16

Open xiaoran33 opened 1 week ago

xiaoran33 commented 1 week ago

1、readme文档中演示的示例来自occlum/hyperenclave:0.27.10-hypermode-1.3.0-ubuntu20.04这个镜像,比如我自己写个简单demo程序想放上来跑,我要怎么把我的程序打入镜像?能否提供一下occlum/hyperenclave:0.27.10-hypermode-1.3.0-ubuntu20.04这个镜像的dockerfile? 2、如果我不用docker的方式,我自己写的简单demo程序怎么跑在hyperenclave上?能否提供具体示例步骤?

Bonjourz commented 1 week ago

Hi @xiaoran33 ,

For question 1, could you please show which program you intend to run in the HyperEnclave environment?

Take a simplest demos as an example, if you have your program example.c, you can take the following steps to run it in occlum:

  1. You need to copy your code file example.c into the directory: /root/occlum/demos/hello_c;
  2. Compile it: occlum-gcc -o program program.c;
  3. Make a new instance: mkdir occlum_program && cd occlum_program;
  4. Initialize and build the instance: occlum init && cp ../occlum_program image/bin/ && occlum build;
  5. Run the occlum instance: occlum run /bin/occlum_program

For question 2, we do not support directly running applications atop HyperEnclave outside the docker container environment.

xiaoran33 commented 1 week ago

好的,明白,那可以提供一下occlum/hyperenclave:0.27.10-hypermode-1.3.0-ubuntu20.04这个镜像的dockerfile文件吗?

Bonjourz commented 1 week ago

Hi @xiaoran33 ,

Currently we do not have the plan to public the Docker file. Could you show why you need the Docker file?

xiaoran33 commented 1 week ago

那我写的简单demo怎么放到你们的提供的occlum/hyperenclave:0.27.10-hypermode-1.3.0-ubuntu20.04这个镜像里面呢,我不把这个demo打到镜像里面,我的demo是无法跑起来的吧?

Bonjourz commented 1 week ago

@xiaoran33

Use options "-v" when creating a docker container. You can search it on website for how to use it.

Also here is an example, you can follow it: https://github.com/asterinas/hyperenclave/tree/master/demos/RemoteAttestation

$ docker run -dt --net=host --device=/dev/hyperenclave \
                --name hyperenclave_container \
                -w /root \
                -v $(pwd)/demos:/root/hyperenclave_demos \
                occlum/hyperenclave:0.27.10-hypermode-1.3.0-ubuntu20.04 \
                bash
-v $(pwd)/demos:/root/hyperenclave_demos

maps the directory $(pwd)/demos in host to /root/hyperenclave_demos in container

xiaoran33 commented 1 week ago

额。。。。只能用这种目录映射吗? (⊙︿⊙)

Bonjourz commented 1 week ago

@xiaoran33 ,

Yes. To my understanding, such method is able to satisfy your requirement.

If you need our further help, suggest describes your requirements in detailed (e.g. which application do you want to run, what is the step) so that we can well understand what you need.