How do you switch profiles on a container?

so i initially created a profile just to get lxc up and running

config: {}
description: Default LXD profile
devices:
  eth0:
    name: eth0
    nictype: macvlan
    parent: enp4s0
    type: nic
  root:
    path: /
    pool: default
    size: 30GB
    type: disk

everything was fine, it pulled an ip in my networks range and I was happy.

I then decided to put lxc containers in their own vlan so they aren’t on the same network as the host

config: {}
description: Default LXD profile
devices:
  eth0:
    name: eth0
    nictype: macvlan
    parent: enp4s0.20
    type: nic
  root:
    path: /
    pool: default
    size: 30GB
    type: disk
name: VLAN20

and that works, however when i

lxc profile remove pihole default 
lxc profile assign pihole VLAN20

it’s still coming up with the old IP as well as the new IP (ignore the ip’s for now they will change)

 lxc list
+--------+---------+------------------+------+------------+-----------+
|  NAME  |  STATE  |       IPV4       | IPV6 |    TYPE    | SNAPSHOTS |
+--------+---------+------------------+------+------------+-----------+
| TEST   | RUNNING | 2.2.2.101 (eth0) |      | PERSISTENT | 0         |
+--------+---------+------------------+------+------------+-----------+
| TEST2  | RUNNING | 2.2.2.102 (eth0) |      | PERSISTENT | 0         |
+--------+---------+------------------+------+------------+-----------+
| pihole | RUNNING | 2.2.2.103 (eth0) |      | PERSISTENT | 0         |
|        |         | 10.1.10.5 (eth0) |      |            |           |
+--------+---------+------------------+------+------------+-----------+

i can easily just blow away the server and create a new one… but when i’m a year down the road and want to change something in the profiles i don’t want to have to do that

Your profile looks good to me. We use a similar profile with VLANs:

config: {}
description: “”
devices:
eth0:
name: eth0
nictype: macvlan
parent: eth0.201
type: nic
eth1:
name: eth1
nictype: macvlan
parent: eth0.202
type: nic
name: Dual_Network
used_by:

I think your problem may be the container itself. Can you spin up a new container with this profile to see if you get double NICs assigned?

yep, it was the container. when you set up pi-hole it tries to keep a static ip even though the original config was for dhcp.