1

I want to run an image which I have already created and uploaded on the docker hub. Is it possible to run that image on lxc/lxd? Basically I want to do performance comparison between docker and lxc.

I have installed skopeo, umoci, go-md2man and jq.

Now, when I try to run the command lxc-create c1 -t oci – --url docker://awaisaz/test:part2 it gives trust policy error. /etc/containers/policy.json not such file or directory

Can anyone suggest me a solution or alternate way to do this?

Awais
  • 27
  • 3
  • 8

1 Answers1

0

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.

RajNikhil Marpu
  • 397
  • 2
  • 4
  • 19
  • 2
    This answers a different question. @Awais wants to run a docker IMAGE in lxc, not a docker INSTANCE in lxc. That means lxc pulling the image and using it as rootfs for a new lxc container. – Eric Nov 07 '22 at 10:00