Occlum安装

目前按照帖子“Occlum安装使用-优快云博客”进行,此贴主要是记录安装过程中的问题。

这里要注意了,在1.3中,"docker run xxx"(特权模式)显示“unable to find image xxx locally,docker:error response from daemon:xxxhttp:request canceled while waitting for connection(client timeout exceeded while awaitting headers”

猜测是网路问题。

解决方案是:解决docker镜像无效的问题_unable to find image 'mysql:latest' locally docker-优快云博客

在/etc/docker/daemon.json配置文件改成如下配置:

{
	  "registry-mirrors": [
          "https://docker.registry.cyou",
		  "https://docker-cf.registry.cyou",
		  "https://dockercf.jsdelivr.fyi",
		  "https://docker.jsdelivr.fyi",
		  "https://dockertest.jsdelivr.fyi",
		  "https://mirror.aliyuncs.com",
		  "https://dockerproxy.com",
		  "https://mirror.baidubce.com",
		  "https://docker.m.daocloud.io",
		  "https://docker.nju.edu.cn",
		  "https://docker.mirrors.sjtug.sjtu.edu.cn",
		  "https://docker.mirrors.ustc.edu.cn",
		  "https://mirror.iscas.ac.cn",
		  "https://docker.rainbond.cc"
      ]
}

保存配置后,执行:systemctl daemon-reload && systemctl restart docker(也可尝试在前面加上sudo)

重复特权模式的docker命令,成功。

接下来根据quick start的流程一步步推进。

不可以直接照抄哦,譬如第一句你需要先定位到hello_world.c在哪,否则就会显示没这个文件,因此先

cd /root/demos/hello_c(千万要注意!是root/demos而不是直接demos/)

然后按照上图即可。说明这个简单的hello_world.c程序可以正常运行。

接下来参考人人都可以“机密计算”:Occlum 使用入门和技术揭秘 | SOFAChannel#18 直播回顾 · SOFAStack的顺序。

为上述hello_world.c程序创建一个 Occlum 的实例目录(使用 occlum new 命令)。

$ occlum new occlum_hello

这里要注意了,需要先cd到最开始,再创建这个目录。

接下来按照帖子中的

$ cd occlum_hello

我们ls一下,可以看到里面含有occlum.json和image以及initfs

接下来的所有命令都是在occlum_hello中进行的。然后我们基于刚刚编译好的 hello_world 制作一个 Occlum 的 Enclave 文件和可信镜像(使用 occlum build 命令)。

$ cp ../hello_world image/bin
$ occlum build

这里要注意了,第一行代码如果你这样写会报错:no such file or directory

因此你需要改成

$ cp /root/demos/hello_c/hello_world image/bin
$ occlum build

会显示built the occlum image and enclave successfully

最后,我们在 SGX 中运行 hello_world(使用 occlum run 命令)。

$ occlum run /bin/hello_world
Hello World!

此时我们可以进入hello_c这个文件夹中,读取一下hello_world.c里面是啥,可以看出来就是很简单的printf(hello world),因此出现上述hello world说明成功了。

因为平常用python较多,因此我又尝试了一下demo中的pythonocclum/demos/python/python_glibc at master · occlum/occlum · GitHub

step1 我pull可以成功,run一直不成功。因此我没有run,而是用了最开始的特权模式下run的代码进入了容器。

这里要注意了,应该是

cd /root/demos/python/python_glibc

其他都没什么问题,也成功了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值