[lxc-users] Moving/copying containers to a different machine with LXC

Valerio Mariani valerio.mariani at gmx.de
Thu Jul 16 07:52:58 UTC 2015


Dear Tycho,

       you were right, it was this problem!

This is awesome! I really like LXD!

Thank you!

  Valerio

On 14.07.2015 22:36, Tycho Andersen wrote:
> On Thu, Jul 09, 2015 at 01:24:50PM +0200, Valerio Mariani wrote:
>> Dear All,
>>
>>    please forgive me if my question is too basic, but I am relatively
>> new to the world of lxc containers.
>>
>> With LXD/LXC I downloaded a centos6 amd64 image on my laptop, I made a
>> container out of it, installing additional software within the
>> container. All works perfectly. I would like now to use this container
>> also on my desktop, where I am also running LXD/LXC, without spending
>> time to create it again.
>>
>> Initially I looked for an export/import command for containers, but
>> could not find any. I then thought of  copying the container between lxd
>> instances using 'lxc copy'.
>>
>> I added my desktop lxd server to my laptop remotes with 'lxc remote
>> add', then I added a localhost "remote" with 'lxc remote add localhost
>> localhost'....
>>
>> I finally tried to launch 'lxc copy localhost:centos6-psana
>> IntelNUC:centos6-psana' where IntelNUC is my desktop and centos6-psana
>> is the container I am trying to copy.
>> However, I got an error, saying:
>> error: websocket: bad handshake
> You're probably hitting:
>
> https://github.com/lxc/lxd/issues/598
>
> if you re-add the remote as 'http://$the_ip' instead of
> 'http://localhost' it should work.
>
> Tycho
>
>> Both lxd instances are version 0.13 and they both run on Ubuntu 15.04
>> systems kept up to date, and on both of them I am using the lxd stable ppa.
>>
>> Launching the command with the debug option gave me the following output:
>>
>> 2015/07/08 00:54:51 fingering the daemon
>> 2015/07/08 00:54:51 raw response:
>> {"type":"sync","status":"Success","status_code":200,"metadata":{"api_compat":1,"auth":"trusted","config":{"core.trust_password":true},"environment":{"backing_fs":"btrfs","driver":"lxc","kernel_version":"3.19.0-21-generic","lxc_version":"1.1.2","lxd_version":"0.12"}}}
>> 2015/07/08 00:54:51 pong received
>> 2015/07/08 00:54:51 raw response:
>> {"type":"sync","status":"Success","status_code":200,"metadata":{"name":"centos6-psana","profiles":["default"],"config":{"volatile.baseImage":"afae698680fcf11b915cc3b6f06b3af6c085a59efa4b368b80ddcf9d66b73e3d","volatile.eth0.hwaddr":"00:16:3e:a9:ae:26"},"expanded_config":{"volatile.baseImage":"afae698680fcf11b915cc3b6f06b3af6c085a59efa4b368b80ddcf9d66b73e3d","volatile.eth0.hwaddr":"00:16:3e:a9:ae:26"},"userdata":"","status":{"status":"STOPPED","status_code":1,"init":0,"ips":null},"devices":{},"expanded_devices":{"eth0":{"hwaddr":"00:16:3e:a9:ae:26","nictype":"bridged","parent":"lxcbr0","type":"nic"}},"ephemeral":false,"log":""}}
>> 2015/07/08 00:54:53 fingering the daemon
>> 2015/07/08 00:54:53 raw response:
>> {"type":"sync","status":"Success","status_code":200,"metadata":{"api_compat":1,"auth":"trusted","config":{"core.trust_password":true},"environment":{"backing_fs":"btrfs","driver":"lxc","kernel_version":"3.19.0-21-generic","lxc_version":"1.1.2","lxd_version":"0.12"}}}
>> 2015/07/08 00:54:53 pong received
>> 2015/07/08 00:54:53 raw response:
>> {"type":"sync","status":"Success","status_code":200,"metadata":["/1.0/profiles/default"]}
>> 2015/07/08 00:54:53 posting {"migration":true}
>>  to https://localhost:8443/1.0/containers/centos6-psana
>> 2015/07/08 00:54:53 raw response:
>> {"type":"async","status":"OK","status_code":100,"operation":"/1.0/operations/a2fa7579-f692-491f-8570-b0d47b510ffb","resources":null,"metadata":{"control":"5e2c8e9ef3bc64d665e660fc48b0b381e3dc929f073336cc6a4e77a6ad8734e7","fs":"a703f1fe7570d30dd2da486370a42bc61fc7f47e40b4a4f93c4f2e69ab01ba2d"}}
>> 2015/07/08 00:54:53 posting
>> {"config":{},"name":"centos6-psana","profiles":["default"],"source":{"base-image":"afae698680fcf11b915cc3b6f06b3af6c085a59efa4b368b80ddcf9d66b73e3d","mode":"pull","operation":"wss://localhost:8443/1.0/operations/a2fa7579-f692-491f-8570-b0d47b510ffb/websocket","secrets":{"control":"5e2c8e9ef3bc64d665e660fc48b0b381e3dc929f073336cc6a4e77a6ad8734e7","fs":"a703f1fe7570d30dd2da486370a42bc61fc7f47e40b4a4f93c4f2e69ab01ba2d"},"type":"migration"}}
>>  to https://192.168.1.101:8443/1.0/containers
>> 2015/07/08 00:55:03 raw response:
>> {"type":"async","status":"OK","status_code":100,"operation":"/1.0/operations/45c6a173-457e-4e04-a8d5-eea6a3324995","resources":{"containers":["/1.0/containers/centos6-psana"]},"metadata":null}
>> 2015/07/08 00:55:03 1.0/operations/45c6a173-457e-4e04-a8d5-eea6a3324995/wait
>> 2015/07/08 00:55:04 raw response:
>> {"type":"sync","status":"Success","status_code":200,"metadata":{"created_at":"2015-07-08T00:55:03.272451527+02:00","updated_at":"2015-07-08T00:55:04.147281945+02:00","status":"Failure","status_code":400,"resources":{"containers":["/1.0/containers/centos6-psana"]},"metadata":"websocket:
>> bad handshake","may_cancel":false}}
>> 2015/07/08 00:55:04 Error caught in main: *errors.errorString
>> error: websocket: bad handshake
>>
>> Am I doing something wrong? Or is 'lxc copy' the wrong way of making a
>> copy of a container on a different machine?
>>
>> Thank you for your help
>>
>>   Valerio
>> _______________________________________________
>> lxc-users mailing list
>> lxc-users at lists.linuxcontainers.org
>> http://lists.linuxcontainers.org/listinfo/lxc-users
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users



More information about the lxc-users mailing list