Skip to content

Using volumes with your ownCloud container

Grey Christoforo edited this page Mar 15, 2016 · 2 revisions

NOTE: if you run into permissions issues while following any of the instructions here, then read this

Storing your data folder outside of the container

It's likely desirable for ownCloud's data storage to be placed in a persistent storage location outside the docker container, on the host's file system for example. Let's imagine you wish to store your docker files in a folder somewhere on your host system instead of the default, which is to store these files inside the docker container.

  1. Create the data storage folder and make sure its permissions are properly set up (run these commands on your host machine prior to running or setting up your ownCloud server for the first time):
mkdir ~/ocData
sudo chgrp 33 ~/ocData
chmod 0770 ~/ocData
  1. From now on, you should insert the following between run and --name when you execute the command to start the container on your host: -v ~/ocData:/usr/share/webapps/owncloud/data. That way your run command will look something like this:
docker run -v ~/ocData:/usr/share/webapps/owncloud/data --name oc -p 80:80 -p 443:443 -d l3iggs/owncloud
  1. That's it. Now continue like normal, maybe by browsing to localhost/owncloud to run through the initial configuration wizard for your ownCloud server.

Storing your configuration settings outside of the container

Similar to the above change, this allows the ownCloud config directory to be stored outside of the docker container and should be run prior to initial setup of your server.

  1. Make a folder to store your ownCloud config data on your host:
mkdir ~/ocConfig
sudo chgrp 33 ~/ocConfig
chmod 0770 ~/ocConfig
  1. From now on, you should insert the following between run and --name when you execute the command to start the container on your host: -v ~/ocConfig:/usr/share/webapps/owncloud/config. That way your run command will look something like this:
docker run -v ~/ocConfig:/usr/share/webapps/owncloud/config --name oc -p 80:80 -p 443:443 -d l3iggs/owncloud
  1. That's it. Now continue like normal, maybe by browsing to localhost/owncloud to run through the initial configuration wizard for your ownCloud server.