How to create my own lxd image

I want to create my own lxd image ubuntu and rockey linux and it should have user called sysops with a public key

You could use the images at the images: with a /cloud variant or use ubuntu: remote (that has cloud-init installed), and then use cloud-init config in LXD to provision a user and a key to avoid needing to maintain your own images.

https://documentation.ubuntu.com/lxd/en/latest/cloud-init/