dockerlxclxd

running an image created through Docker in lxc


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?


Solution

  • 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.