How to download a file or directory from a LXC container

To download files, use

lxc-file-pull-example.sh
lxc file pull [container name]/[path]/[filename] [target directory]

To download directories, use

lxc-file-pull-recursive-example.sh
lxc file pull --recursive [container name]/[path]/[filename] [target directory]

Examples:

Download /root/myfile.txt from mycontainer to the current directory (.):

lxc-file-pull-myfile.sh
lxc file pull mycontainer/root/myfile.txt .

Download /root/mydirectory from mycontainer to the current directory (.):

lxc-file-pull-mydir.sh
lxc file pull -r mycontainer/root/mydirectory .

Check out similar posts by category: Container, Linux, LXC, Virtualization