新しいホストでLinuxコンテナを移動して実行する方法は?

新しいホストでLinuxコンテナを移動して実行する方法は?

Linuxコンテナを新しいホストに移動する正しい手順は何ですか?私が成功しなかったことは次のとおりです。

  1. Linuxコンテナを含むディレクトリを圧縮します。 sudo tar -cjf sample_container.tar.bz2 <path-to-container>/sample_container
  2. 圧縮tarファイルを新しいホストにコピーします(scp、rsyncなどを介して)。
  3. 新しいホストでtarファイルを解凍します。 sudo -jxvf sample_container.tar.bz2
  4. sample_container/configrootfs新しいパス(たとえば、新しいホストへのパス)で更新

上記の手順を実行しても機能しないようです。私は何が間違っていましたか?

修正する: 以下は、コンテナを実行しようとしたときに得られるログ出力です。

lxc-start 20161111164704.185 ERROR    lxc_conf - conf.c:mount_rootfs:807 - Permission denied - failed to get real path for '/home/newhost/dir1/dir2/lxc/mycontainer_trusty_lxc/rootfs'
lxc-start 20161111164704.185 ERROR    lxc_conf - conf.c:setup_rootfs:1221 - failed to mount rootfs
lxc-start 20161111164704.185 ERROR    lxc_conf - conf.c:do_rootfs_setup:3631 - failed to setup rootfs for 'mycontainer_trusty_lxc'
lxc-start 20161111164704.185 ERROR    lxc_conf - conf.c:lxc_setup:3713 - Error setting up rootfs mount after spawn
lxc-start 20161111164704.185 ERROR    lxc_start - start.c:do_start:834 - failed to setup the container
lxc-start 20161111164704.185 ERROR    lxc_sync - sync.c:__sync_wait:57 - An error occurred in another process (expected sequence number 3)
lxc-start 20161111164704.185 ERROR    lxc_start - start.c:__lxc_start:1354 - failed to spawn 'mycontainer_trusty_lxc'
lxc-start 20161111164709.723 ERROR    lxc_start_ui - tools/lxc_start.c:main:344 - The container failed to start.
lxc-start 20161111164709.723 ERROR    lxc_start_ui - tools/lxc_start.c:main:346 - To get more details, run the container in foreground mode.
lxc-start 20161111164709.723 ERROR    lxc_start_ui - tools/lxc_start.c:main:348 - Additional information can be obtained by setting the --logfile and --logpriority options.

ベストアンサー1

おすすめ記事