To access LXC container filesystem use the following trick:

The following command

# lxc-info -n p1 -p -H

prints the process number of the respective container.

We can use this process number to access the container’s file system. For example to list the container’s root directory execute the following:

# ls -lh /proc/$(lxc-info -n p1 -p -H)/root/

where p1 is the container number. Yuo can copy files also by using this logic.

# cp anyfile /proc/$(lxc-info -n p1 -p -H)/root/destdir/
How to access LXC container’s filesystem from the main host
Tagged on:         

Leave a Reply