[lxc-devel] [PATCH v2] Add lxc-copy executable

Christian Brauner christianvanbrauner at gmail.com
Fri Nov 6 10:33:52 UTC 2015


On Thu, Nov 05, 2015 at 11:15:08PM +0000, Serge Hallyn wrote:
> Quoting Christian Brauner (christianvanbrauner at gmail.com):
> > This is a complete reimplementation of lxc-clone and lxc-start-ephemeral.
> > lxc-copy merges the functionalities of lxc-clone + lxc-start-ephemeral into one
> > executable.
> > 
> > (1) Cloning containers:
> > 
> > 	(a) as copy:
> > 
> > 		lxc-copy -n aa -N bb
> > 
> > 	(b) as snapshot:
> > 
> > 		lxc-copy -n aa -N bb -s
> > 
> > (2) Renaming containers:
> > 
> > 	lxc-copy -n aa -N bb -R
> > 
> > (3) Starting ephemeral containers:
> > 
> > 	(a) start ephemeral container as daemon with random name:
> > 
> > 		lxc-copy -n aa -e
> > 
> > 	(b) start ephemeral container in foreground mode with random name:
> > 
> > 		lxc-copy -n aa -e -F
> > 
> > 	(c) start ephemeral container with specified name as daemon:
> > 
> > 		lxc-copy -n aa -N bb
> 
> ^  you didn't add '-e' here.  Is that a typo in this example?
Yes, this is a typo.

> 
> by "as daemon" you mean daemonized (-d) mode right?
Yes, I mean daemonized. The name of the flag was modelled after lxc-start which
also uses [-d|--daemon].

> 
> > 	(d) start non-ephemeral container as daemon:
> > 
> > 		lxc-copy -n aa -K
> 
> > 	(e) start ephemeral container with custom mounts (additional mounts can
> >             be of type {bind,aufs,overlay}) as daemon:
> > 
> > 		lxc-copy -n aa -e -m bind=/src:/dest:ro,aufs=/src:/dest:rw,overlay=/src:/dest
> 
> I can't quite tell how to distinguish here between a command
> which does or does not start the container.
Sorry, this is a typo in example (d).
The flag [-e|--ephemeral] starts a container.

> 
> How about adding an explicity [-S|--start] without which the
> copy is created but not started?
That is exactly what [-e|--ephemeral] does.

> 
> Is there any meaningful difference between
> 
> 	lxc-copy -n aa -e -D -s
> and
> 	lxc-copy -n aa -s
> ?
Yes, in the first example the container is also started and [-e|--ephemeral]
implies [-s|--snapshot] anyway.

> 
> Or should we just have '-e: ephemeral, deleted when done' versus
> no -e: copy is persistent.
Yes, this is the current implementation and meaning of [-e|--ephemeral]. The two
examples (c) and (d) in the commit message which confused you are just missing
the [-e|--ephemeral] flag. I'll resend the patch with the examples fixed and
some more notes in the commit message about ephemeral containers.


More information about the lxc-devel mailing list