Unexpected image publication behavior when using remote spec that resolves to current host

This is under LXD 3.18.

The behavior I’m seeing is that if I try to publish a container using a remote spec that resolves to the host I’m currently working on, the target image is not registered. It doesn’t fail. It tells me it s completes but a lxc image list doesn’t contain the expected image.

Here’s the setup:

  • I log onto my LXC server
  • I create a remote named test as follows: lxc remote add test unix://. (Note I’ve also tried it with the IP of the host).
  • I run the command: lxc publish test:my_container --alias testimage

LXC churns away, completes successfully but a lxc image list does not show testimage.


That makes sense, when dealing with a destination remote that’s different from the source remote, the publish logic becomes:

  • publish the container on the source remote
  • copy the image
  • setup the aliases
  • delete the image on the source remote

If source and target end up pointing to the same host somehow, then that last delete will delete the image.