I have an existing container that i am looking to give a static IP, using the API, what request would i send to do this?
GET /1.0/instances/NAME
and then either alter the entry under devices
or if there’s none, copy the one from expanded_devices
to devices
and alter it there. Then PUT /1.0/instances/NAME
to update it.
So I have this request (PUT to /1.0/instances/container)
{ "devices": { "eth0": { "name": "eth0", "nictype": "bridged", "parent": "lxdbr0", "type": "nic" } }
}
However I’m not sure what field to set in order to change the IP.
ipv4.address
Note that you must send the entire thing back, or use a PATCH query instead.
Should one also exclude that static IP from the DHCP pool?
No, that creates a static allocation in dnsmasq so it won’t assign it to something else.