3

I have a load (~14) of LXD containers running on my 14.04 development machine.

I would like to do a clean install of 16.04 but I need to keep my containers.

What is the best approach to achieve this?

Should I publish the containers as images and then create new containers using those images when 16.04 is installed?

1 Answer 1

4

On your old Ubuntu 14.04:

  1. Publish your Container:

    lxc publish --force 'name of container" --alias 'new name' 
    

    Example:

    lxc publish --force 'lxc-wordpress' --alias 'lxc-image-wordpress' 
    
  2. Export image:

    lxc image  export 'new name' 
    

The output is something like this:

efaa243331f0a7c175376edaf796545a01ad09bb47f25a297b798e09fe66ee66.tar.gz 

Show size of export:

    du -h efaa243331f0a7c175376edaf796545a01ad09bb47f25a297b798e09fe66ee66.tar.gz 
  1. Backup your export image.

  2. Backup your containers profile/s you can show with:

    lxc profile list
    

You can save your *tar.gz in whatever secure place.

Install Ubuntu 16.04.2 and configure your LXD environment

Copy your backup image and, inside their directory, start import

  1. Import your container images:

     lxc image import efaa243331f0a7c175376edaf796545a01ad09bb47f25a297b798e09fe66ee66.tar.gz --alias lxc-image-wordpress 
    
  2. Create and start your container based on your image:

     lxc launch lxc-image-wordpress lxc-wordpress
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .