Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added majority of lxd copy between hosts.

...

Also keep this concept in mind even when referencing cached images.

...

Copying Containers Between Hosts

We can will now clone from copy myhost01, container01 (which is running Apache into) into myhost02. The copy is identical except no snapshots and volatile keys are regenerated. For example, the MAC address will be reset and a new host name embedded.

There are two key methods. Clone semi-live using snapshots and shutting down first.

...

Code Block
languagebash
lxc stop myhost01:container01
# Verify container stopped
lxc list myhost01:
+-------------+---------+------+------+------------+-----------+
|    NAME     |  STATE  | IPV4 | IPV6 |    TYPE    | SNAPSHOTS |
+-------------+---------+------+------+------------+-----------+
| container01 | STOPPED |      |      | PERSISTENT | 0         |
+-------------+---------+------+------+------------+-----------+


lxc copy myhost01:container01 web01

...

Code Block
languagebash
lxc list
+-------+---------+------+------+------------+-----------+
| NAME  |  STATE  | IPV4 | IPV6 |    TYPE    | SNAPSHOTS |
+-------+---------+------+------+------------+-----------+
| web01 | STOPPED |      |      | PERSISTENT | 0         |
+-------+---------+------+------+------------+-----------+

...

Semi-Live Approach

...

Moving Containers

The copy is identical in every way except will not have any snapshots and volatile keys. For example, the MAC address will be reset. If you want to an exact duplicate or move a container

Advanced Tuning of Containers

...