Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Copying Containers Between Hosts

We will now 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.

Shutdown Approach

Log into myhost02

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

With copy, the new container is identical in every way except no snapshots and volatile keys (ie MAC address and hostnames) will be regenerated.

Creating an exact duplicate or moving a container is a different concept but just as easy.

Current Limitations and Considerations

  • Consistency of host IDs which impact containers
  • Architecture
  • Baselining host patches and OS layer
  • ...

Advanced Tuning of Containers

...

Remote Container Management - https://www.stgraber.org/2016/03/19/lxd-2-0-your-first-lxd-container-312/

Live Container Migrations - https://bobcares.com/blog/lxc-live-migration-to-minimize-business-downtime/