[lxc-users] [LXD] how to set container description (in a script)?

Stéphane Graber stgraber at ubuntu.com
Tue Mar 12 17:00:18 UTC 2019


On Tue, Mar 12, 2019 at 08:34:02PM +0900, Tomasz Chmielewski wrote:
> I would like to add some own "metadata" for a container.
> 
> I thought I'd use "description" for that, since it's present in "lxc config
> show <container>":
> 
> This however doesn't work:
> 
> $ lxc config show testcontainer | grep ^description
> description: ""
> 
> $ lxc config set testcontainer description "some description"
> Error: Invalid config: Unknown configuration key: description
> 
> 
> What would be the best way to set the description for a container?

Unfortunately the CLI doesn't have a great way to non-interactively
modify the description. Your best bet is to use `lxc config show` piped
through `sed` and then piped back into `lxc config edit`, something
like:

lxc config show testcontainer | sed "s/description:.*/description: \"blah\"/" | lxc config edit testcontainer

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20190312/10b7b43d/attachment.sig>


More information about the lxc-users mailing list