Hello. In this post, I will teach you how to deploy Owncloud using Docker compose. It will be brief but explained step by step.
Briefly, I will tell you that Docker compose is more thought of production environments where compatibility should be as high as possible. This is precisely the great advantage of Docker images that we will be able to use in any supported system thanks to the technology of containers. Then, these steps can be done from any Linux distribution that has installed Docker and Docker Compose.
Owncloud is one of the best-known solutions to create our own private cloud as if it were a professional service. Of course, by this I do not mean that Owncloud is not professional, I mean that its behavior is similar to that of proprietary solutions such as Google Drive or OneDrive.
So let’s get to work.
Install Docker and Docker Compose on Linux
The first step is to have Docker installed in the system, obviously.
- If you are using Ubuntu: How to install Docker on Ubuntu 18.04?
- For CentOS 8: How to install Docker on CentOS 8?
- For CentOS 7: How to install Docker CE on CentOS 7?
- If you use Windows: How to install Docker in Windows 10?
- Or, if you are using Debian 10: How to install Docker on Debian 10?
And using your distribution’s package manager, you can install Docker Compose. For example:
:~$ sudo apt docker-compose
For Debian, Ubuntu, and derivatives.
:~$ sudo dnf install docker-compose
Or, for RHEL, CentOS and derivatives.
Deploy Owncloud using Docker compose
Well, the first step is to create a new folder where we will do the process.
:~$ mkdir owncloud
:~$ cd owncloud
Then, in that folder create a new file called docker-compose.yml that contains all the instructions for deployment. When you create it, add the following:
:~$ sudo nano docker-compose.yml
version: '3.1'
services:
owncloud:
image: owncloud
restart: always
ports:
- 1234:80
volumes:
- /home/angelo/owncloud_data:/var/www/html
- /home/angelo/owncloud_data/apps:/var/www/html/apps
- /home/angelo/owncloud_data/config:/var/www/html/config
- /home/angelo/owncloud_data/data:/var/www/html/data
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: angelo123
I proceed to explain.
In this file, we will raise two services. The first is the Owncloud. The image is configured for Owncloud to run on port 80, but I exposed port 1234. You can set the number you want but don’t touch 80.
Then come the volumes. The first part is folders on our host system to make sure the data is persistent. These folders must be created before the services are deployed.
After this, comes the second service. By default, the Owncloud image is configured to use SQLite. But in this case, we have decided to use MariaDB. All simple just set up an initial key and you’re done.
Let us create the volume folders.
:~$ mkdir /home/angelo/owncloud_data
:~$ mkdir /home/angelo/owncloud_data/apps
:~$ mkdir /home/angelo/owncloud_data/config
:~$ mkdir /home/angelo/owncloud_data/data
Then, run Docker Compose.
:~$ sudo docker-compose up -d
That’s enough. Now open your web browser and go to http://your-server:1234
and you will see the following. Create an admin account.
Next, configure the Database.
Finally, you’ll see the login screen and you are done. You can now use Owncloud.
Conclusion
Owncloud is a really useful application. And to deploy it using Docker compose is something easy and within everyone’s reach.
For more information on this, see the official documentation of the Owncloud Docker image.
Great tutorial, thanks!