Results 1 to 3 of 3

Thread: LXD 2.2x: How do I copy files to all containers

  1. #1
    Join Date
    Apr 2013
    Beans
    4

    LXD 2.2x: How do I copy files to all containers

    My LXD host is using ZFS as the back end storage.
    My LXD host has some files, eg., /etc/*****, and I want to copy these files to all containers prior to starting the containers. How would I go about this?
    My LXD host has some user files, and I want to copy these files to all containers prior to starting the containers. How would I go about this, assuming I want it to go to /home/ubuntu/subdir/....?

    How would I go about appending a file from LXD host to a container?

  2. #2
    Join Date
    Apr 2013
    Beans
    4

    Re: LXD 2.2x: How do I copy files to all containers

    I found the answer to some of my questions:

    display the help
    lxc file ?
    push a pattern of files
    lxc file push -p /tmp/test* lxd001/tmp/newdir/
    push multiple files
    lxc file push -p /tmp/test* /etc/host* lxd001/tmp/newdir/


    I could not find a way to push to all containers, the only way is to script it.

    There is no way to append files, the only way is to script it.


  3. #3
    Join Date
    Aug 2005
    Beans
    368

    Re: LXD 2.2x: How do I copy files to all containers

    I think the most elegant way is to use cloud-init, as shown in the tutorial at
    https://blog.simos.info/how-to-preco...th-cloud-init/

    You edit an LXD profile with the cloud-init instructions that will copy the files and make other changes.

    The alternative that you are suggesting when the containers are not running, is to edit the container files directly.
    Those container files are in /var/lib/lxd/containers/... (or /var/snap/lxd/common/lxd/containers/ if you use LXD as a snap).

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •