Copy container among remote LXD hosts - source server not listening on the network

I am trying to copy a container from one host to another (running LXD 3.0.3 & 3.0.4) with the following steps:

  1. create new lxc [target_host]
  2. configure [target_host] to be available over the network (lxd init)
  3. host2 needs to accept ssh login with PassworAuthentification
  4. on [source_host] run
    lxc remote add [target_host] [ip-addresse]
    lxc copy [container/snapshot] [target_host]:[newcontainername]

but I am getting the below error, which seems to indicate that the [source_host] server also needs to be configured to “listen” over the network.

$ lxc copy [container] [target_host]:[container_name]
Error: The source server isn't listening on the network
  • how can I enable listening over the network on an existing LDX daemon? Do I need to carefully re-run ‘lxd init’ or ist there any other way to do this?
  • can you switch that feature on an off?

lxc config set core.https_address :8443 should do the trick, or something more specific if you have multiple addresses.

If running a modern enough LXD, you can also use --mode=relay in lxc copy so you don’t need this.

that worked for me just fine. thx as always.

worked once … I needed to rebuild the target server and now on the second copy I am getting trouble with a proxy device attached to my container

~$ lxc copy --mode=relay ct1 host2:ct2
Error: Invalid devices: Device validation failed for "myport443": Invalid value for device option "connect": Not an IP address "localhost"

on my source server

~$ lxc config device show erpnext1 
myport80:
  connect: tcp:localhost:80
  listen: tcp:96.217.205.xxx:80
  type: proxy
myport443:
  connect: tcp:localhost:443
  listen: tcp:0.0.0.0:443
  type: proxy

so I remove and recreate the 2 proxies with connect: tcp:127.0.0.1:[port] instead the localhost which gave the error. Still the lxc copy operation throws the same error message, even with the old device names (changed from myport80 -> port80 in the recreation process.

I thought this could be some sort of caching issue so I restartet the daemon and (when this did not heal anything) restarted the host server alltogether … same error (with reference to the old proxy device) pops up again.

Even if I remove the proxy devices from that container completely before running the
lxc copy --mode=relay [ct1] lxd2:[ct2]
command I get that error.

any idea what I can do now?

hm … specifying a snapshot did the job apparently. I believe it wans’t necesarry the last time I tried (which makes sense because it is not impossible that you want to copy a container with all snapshots to a different host)