Updating an Owncloud instance running in docker

Introduction

Now that we have a Owncloud server up and running, we have to apply security fixes when they are published in order to avoid nasty surprises.
To update a container, it’s better to create a new image based on updated software components rather than applying updates inside a running container. In this post, I describe how to update a Owncloud server running in a Raspberry Pi docker container.

If you pull a owncloud image which contains a major version which is different from your current owncloud image, the container will fail to start as it Apache won’t find the correct php library.

For instance, if the previous image was using PHP 5 and the new one is using PHP 7, you have to modify the Apache 2 configuration in order to load the correct PHP module.
Modify the volume from the docker host (you have to be root):

Connect to owncloud and check that the instance is still working properly.

Note about let’s encrypt:In my first version of owncloud image, the /etc/letsencrypt folder was not declared as a volume. As a consequence, certificates were lost when you upgraded the Owncloud image. In this case, the Owncloud container will close immediatly as Apache will fail to start (failing to load the certificate and private key).