Aside from using lxc config edit <containername>, how do I set the 'description' for a container?


(Adam Chalkley) #1

Hi,

Thanks in advance for reading this and for any guidance you can offer.

My apologies if this is already well covered somewhere, but I looked over the docs and didn’t see what variation of lxc config set or lxc config get was needed in order to retrieve or populate the description field for a container.

$ lxc version
Client version: 3.0.3
Server version: 3.0.3
$ lxc init ubuntu:18.04 forum-question-demo
Creating forum-question-demo
$ lxc config show forum-question-demo
architecture: x86_64
config:
  image.architecture: amd64
  image.description: ubuntu 18.04 LTS amd64 (release) (20190402)
  image.label: release
  image.os: ubuntu
  image.release: bionic
  image.serial: "20190402"
  image.version: "18.04"
  volatile.apply_template: create
  volatile.base_image: 663f6663aed66a22dd708c4b07514748221522b810008c55002fcc1dd81af377
  volatile.eth0.hwaddr: 00:16:3e:09:86:4b
  volatile.idmap.base: "0"
  volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":300000,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":300000,"Nsid":0,"Maprange":65536}]'
  volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":300000,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":300000,"Nsid":0,"Maprange":65536}]'
devices: {}
ephemeral: false
profiles:
- default
stateful: false
description: ""

I want to get/set the description field as shown here:

...
profiles:
- default
stateful: false
description: ""

Is this supported?

Thanks.


#2

The lxc config set ... command is for the keys under the config: section.
To edit the description, you would need to

 lxc config edit mycontainer

and then use your editor to edit in-place the description: field.

Alternatively, you can lxc config show mycontainer to get the full YAML configuration.
Then, edit the full YAML configuration by adding the description.
Finally, you can lxc config edit mycontainer < mynewconfiguration.yaml.


(Adam Chalkley) #3

Thank you for your help. I’ll use the suggested approaches to manage that field.