How to change containers IP without bringing it up?

We are cloning lxc containers to another host in the same data center for backup purposes using lxc copy. To verify the content we need to bring it up but then there is IP addresses clash.

Is there any to modify the clone’s IP address without bringing it up ?

How are you getting/setting your ip? When copying the copy gets a fresh mac address.

ddavis@fruiteth ansible % lxc snapshot kif freebsd-test
ddavis@fruiteth ansible % lxc copy kif/freebsd-test freebsd-test-1
ddavis@fruiteth ansible % lxc config show kif |grep eth
  volatile.eth0.host_name: tap468fe010
  volatile.eth0.hwaddr: 00:16:3e:1d:c8:bd
  eth0:
    name: eth0
ddavis@fruiteth ansible % lxc config show freebsd-test-1 |grep eth
  volatile.eth0.hwaddr: 00:16:3e:26:44:bd
  eth0:
    name: eth0

If you are using netplan/ifconfig or some other static ip’s inside of the container then you should be able to manipulate the files before bringing the new server up

For containers you can also use lxc file ... commands when the instance is stopped.