Updating docker from different repo

Hello,

I will soon be upgrading my OS (Fedora 20) to the latest one (Fedora 22 or 23). I currently have docker installed through Fedora’s repositories (Docker version 1.5.0, build a8a31ef/1.5.0). I will most likely remove and reinstall Fedora from scratch, and I will install Docker from Docker’s own repository so that I can stay up with the latest version.

I have moved the current docker data folder from /var/lib/docker to a separate partition on the disk. Should I assume that Docker 1.8 will be fully compatible with images/containers created by 1.5? So once I configure the new Docker to use the existing data folder, should I expect everything to work? Is there anything else I may need to do so that I don’t lose any containers?

I have just a couple of random points to touch on:

If you just copy over your /var/lib/docker folder:

  • Make sure that whatever storage driver you are using now will be the same one that you use on your new setup. If you switch your storage driver, the new driver won’t see stuff stored by the old driver. My guess is that it’ll be devicemapper for both your existing and new setups so this is not likely to be a major issue.
  • Reports of data loss due to version upgrades is rare.
  • It’s always possible that something could go wrong, so backups are always good to have.

Other approaches:

  • You could ‘docker save’ all your images, tar up all your volumes, and ‘docker inspect’ all your containers. Manually ‘docker create’ all containers again, and repopulate their volumes by hand. It’s a lot of trouble, but if you did want to switch storage drivers, this is the general approach.

  • As long as you have your images in a registry somewhere, you should be able to re-create your containers using a script of some sort. Docker-compose is one project that lets this happen. I’ve also seen other people toss in some ‘docker create’ or ‘docker run’ commands into a shell script or Makefile. If you can get your setup to that point, your question will be more of a “how do I backup/restore my volumes” rather than “how do I backup/restore my entire docker installation”

/Jeff

Hi Jeff, thanks for the useful information. Just to note that all worked smoothly.

  • My docker folder already existed on a separate partition.
  • I made a fresh install of Fedora 23.
  • Installed docker engine from Fedora repos and configured the data directory.

All good so far.