I am trying to set a static IP address in an lxd container. The container is made with:
nonroot $ lxc launch images:centos/7/amd64 my_centos
in a pretty bogstandard lxd (just the default apt-get install lxd; service lxd start) environment. Now I want to give that thing a static IP 10.0.3.50 (say).
After some googling (why this isn't clear from the documentation on the site isn't clear to me yet), I found that the profile information, which I have to hack to get that done, was in a sqlite database. Okay:
lxc profile copy default my_centos
lxc profile edit my_centos
...
name: my_centos
config: {}
description: ""
devices:
eth0:
name: eth0
nictype: bridged
parent: lxcbr0
type: nic
and it won't let me change it to:
name: my_centos
config:
raw.lxc:
lxc.network.type = veth
lxc.network.name = eth0
lxc.network.link = lxcbr0
lxc.network.ipv4 = 10.0.3.50/24
lxc.network.ipv4.gateway = 10.0.3.1
lxc.network.flags = up
description: ""
devices:
eth0:
name: eth0
nictype: bridged
parent: lxcbr0
type: nic
The error is: Config parsing error: Only interface-specific ipv4/ipv6 lxc.network keys are allowed
This probably has to do with the nictype and the type of eth0, but removing the device has the same effect.
Can someone enlighten me on the right way to do this ?
This is kinda related with LXD containers and networking with static IP, but I want to set this up with lxd (so, with profiles instead of config files).