0

I can access files inside a LXD container by running lxc from the host:

root@Host# lxc exec Container_Name bash
root@Container_Name# touch /tmp/hello

Or by accessing the files directly from the host under /var/lib/lxd/containers/Container_Name/rootfs:

root@Host# touch /var/lib/lxd/containers/Container_Name/rootfs/tmp/hello

Is there a preferred way?

1
  • Depends on what do you want to achieve. If you only want to create a file, the second example is totally fine. If you want to automate this process for multiple containers, have a look at cloud-init.
    – J. Pee
    Jul 15, 2018 at 20:45

1 Answer 1

0

You should use the exec command so that permissions will be set according to the user/group mapping of the container.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .