Bind mounting for cloned containers is too hard; provide equivalent of lxc-start-ephemeral --bind option

Bug #1304309 reported by Martin Pitt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

In order to efficiently exchange data with a test bed in a container, I make ample use of lxc-start-ephemeral's --bdir option to bind-mount a temp dir from the host into the container. However, we can't use ephemeral in autopkgtest production as that leads to failure of some tests due to bugs in overlayfs/aufs.

The problem is that with lxc-clone and lxc-start there is no counterpart at all for the --bdir option. So to do the equivalent thing, one needs to detect the LXC path (lxc-config lxc.lxcpath), make assumptions about the file layout in the container dir (/rootfs, /config), manually mkdir -p the bind mount path, and add the bind mount to config. This feels like poking around in internals way too much and thus not very future-proof, and it's also a lot of effort:

  http://anonscm.debian.org/gitweb/?p=autopkgtest/autopkgtest.git;a=commitdiff;h=5fbbe3f05f4

Could lxc-clone or lxc-start grow a --bdir option as well, to make this simpler and keep the knowledge of paths and file layouts within LXC itself?

Revision history for this message
Stéphane Graber (stgraber) wrote :

You could use something like:
lxc-start -n my-container -s "lxc.mount.entry=/path/on/host path/in/container none bind,create=dir 0 0"

Which will bind-mount /path/on/host to <rootfs>/path/in/container and create the target path if missing.

Revision history for this message
Martin Pitt (pitti) wrote :

Yay, I completely missed that possibility. Thanks!

Changed in lxc (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.