How to deploy Owncloud using Docker

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. In this post, you will learn how to deploy Owncloud using Docker. The process is much easier than doing it manually, but it’s all up to you.

Introduction – Docker

Docker is a software development platform for virtualization with multiple operating systems running on the same host. This is made possible by containers that are distributed as images.

The system is very lightweight because it does not incorporate an operating system, which also allows for better use of resources. Docker also allows applications to be isolated, which is very useful for testing without bringing down the client’s production server.

And next…. Owncloud

Owncloud is a web application that allows us to have a private cloud on a server that we can manage. It is completely free and open source, so we have no license limits and the capacity is set by the server.

Deploy Owncloud using Docker

To make this post, we will use Docker Compose, so in a single file we have everything we need.

To achieve this, first install Docker in Ubuntu 22.04 and then from this link install Docker Compose.

Then create a new folder for Owncloud

mkdir owncloud

Access it

cd owncloud

And create a docker-compose file

nano docker-compose.yml

Then paste all this content

version: "3"

volumes:
  files:
    driver: local
  mysql:
    driver: local
  redis:
    driver: local

services:
  owncloud:
    image: owncloud/server:latest
    container_name: owncloud_server
    restart: always
    ports:
      - 80:8080
    depends_on:
      - mariadb
      - redis
    environment:
      - OWNCLOUD_DOMAIN=cloud.unixcop.com
      - OWNCLOUD_DB_TYPE=mysql
      - OWNCLOUD_DB_NAME=owncloud
      - OWNCLOUD_DB_USERNAME=owncloud
      - OWNCLOUD_DB_PASSWORD=owncloud
      - OWNCLOUD_DB_HOST=mariadb
      - OWNCLOUD_ADMIN_USERNAME=unixcop
      - OWNCLOUD_ADMIN_PASSWORD=unixcop12
      - OWNCLOUD_MYSQL_UTF8MB4=true
      - OWNCLOUD_REDIS_ENABLED=true
      - OWNCLOUD_REDIS_HOST=redis
    volumes:
      - files:/mnt/data

  mariadb:
    image: mariadb:latest
    container_name: owncloud_mariadb
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=owncloud
      - MYSQL_USER=owncloud
      - MYSQL_PASSWORD=owncloud
      - MYSQL_DATABASE=owncloud
    volumes:
      - mysql:/var/lib/mysql

  redis:
    image: redis:6
    container_name: owncloud_redis
    restart: always
    command: ["--databases", "1"]
 
   volumes:
      - redis:/data

The file itself is very explicit, but let’s take it with a grain of salt. First, we will use 3 docker images: Owncloud, MariaDB and Redis. Each one in its function.

The image we will use is latest i.e. the latest stable version. Its input variables will allow us to fully configure it. It is up to you to make the necessary modifications. Remember that some data such as those concerning MariaDB and Redis have to be written down because you will need them later. Finally, choose a port that will be exposed on your computer by the 8080 in the image. This port and the host are where you will be able to access via web and decide the mount point for the default data is /mnt/data.

Then there is the MariaDB image that we simply have to configure with a root password, the user password for Owncloud and its password and the database. Remember that this data must be the same as the Owncloud configuration.

Finally, we have the Redis image, whose configuration is even simpler. Just modify the data folder.

Save the changes and close the editor.

Login to Owncloud

Now pull up the images and the deployment with the following command:

sudo docker compose up -d
Deploy Owncloud using Docker
Deploy Owncloud using Docker

And finally access with your web browser to the defined domain, and you will see the login screen

Owncloud login screen
Owncloud login screen

Log in with your user defined in the Docker Compose file, and you will see the dashboard.

Owncloud running after installation
Owncloud running after installation

Conclusion

In this post, you learned how to deploy Owncloud using Docker without major problems.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook