How do I use LXC container comments - or Adding a couple USER Defined fields to LXC List

I am getting pretty good at Greping Lxc list. and coming up with container names.
But My life managing hundred of containers would be so wonderful if I could have just two extra fields in information held with container that I could change. One I would use container staging-versioning and other for last backup date. We use our own programs for this and would otherwise create a separate database to hold this info, and then I could not sort in lxc so easily.

I can see comments here:
lxc list -c ns,user.comment:comment

But no idea how to add them or if there are more of these fields.\

Thanks

It’s not possible to add keys using
lxc config <instance> user.comment="blah"
but you can do it by editing the yaml (lxc config edit instance). Curiously unsetting the key works. Maybe this feature has been thought only for inheriting keys from templates. Or this strange limitation is a good’ole bug. Anyway, you can create any number of user.xxx keys you want.

lxc config edit trusty

config:
  image.architecture: amd64
  image.description: Ubuntu trusty amd64 (20200117_07:42)
  image.os: Ubuntu
  image.release: trusty
  image.serial: "20200117_07:42"
  image.type: squashfs
  user.comment: this is my awesome comment.
  user.orientation: south
  user.speed: fast

lxc list -c ns,user.comment:comment,user.orientation:orientation,user.speed:speed | grep trusty

| trusty | RUNNING | this is my awesome comment. | south | fast |

Hi!

You may consider using a different lxc list output (than table), such as yaml or json.
With yaml, you can get the full list of information available from the container.

lxc list --format yaml

Alternatively, you can install jq, with either one of the two,

sudo apt get install jq

or

sudo snap install jq

and then run

lxc list --format=json | jq .

This jq . will pretty-print, with colors and all, the output. You can then process the JSON data with jq, per https://stedolan.github.io/jq/tutorial/.

It looks like a feature.

$ lxc config set local:vm4 user.comment="My VM"
Error: cannot set 'local:vm4' to 'user.comment=My VM': unknown key
$ lxc config set local:vm4 user.comment "My VM"
$ 

That is, if you use the old style of setting keys (without the = sign), it works.

Wrote an issue at https://github.com/lxc/lxd/issues/6754

Thanks, I do use jason pretty print for some things. The comment feature is not very well know or used.
I am going to be using it a lot to document the date last backup and purpose of container, and possibly client.