1

我想运行一个我已经在 docker hub 上创建并上传的图像。是否可以在 lxc/lxd 上运行该图像?基本上我想在docker和lxc之间进行性能比较。

我已经安装了 skopeo、umoci、go-md2man 和 jq。

现在,当我尝试运行命令 lxc-create c1 -t oci – --url docker://awaisaz/test:part2 时,它会给出信任策略错误。/etc/containers/policy.json 不是这样的文件或目录

谁能建议我一个解决方案或替代方法来做到这一点?

4

1 回答 1

1

So, you want to run a docker container inside an LXC Container.

firstly, you need to make docker process up and running inside an lxc container.

   sudo lxc config edit <lxc-container-name>

In Config Object, Add

   linux.kernel_modules: overlay,ip_tables
   security.nesting: true
   security.privileged: true

Then Exit from that YAML File, And Restart the LXC Container

   sudo lxc restart <container_name>

After Successfull restart of LXC Container.

exec into that container by

   sudo lxc exec <container_name> /bin/bash

Then,

   sudo rm /var/lib/docker/network/files/local-kv.db

Restart Docker Service,

   service docker restart (In LXC Container)

Then you can use docker process in LXC Container as if you are in a VM.

于 2019-07-23T06:40:00.447 回答