Running OwnCloud in Docker on Linux 🌱

What is OwnCloud?

OwnCloud is a suite of client-server software for creating file hosting services and using them. OwnCloud is functionally very similar to the widely used Dropbox, with the primary functional difference being that OwnCloud is free and open-source, and thereby allowing anyone to install and operate it without charge on a private server. -

Installing Docker

  1. Log into the Linux based device
  2. Run the following commands in the terminal
    # install prerequisites
    sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
    # add docker gpg key
    curl -fsSL$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
    # add docker software repository
    sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)]$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
    # install docker
    sudo apt install docker-ce docker-compose -y
    # enable and start docker service
    sudo systemctl enable docker && sudo systemctl start docker
    # add the current user to the docker group
    sudo usermod -aG docker $USER
    # reauthenticate for the new group membership to take effect
    su - $USER

Running OwnCLoud

  1. Now that Docker is installed, run the following commands to setup the OwnCloud Docker container and run it
    # create working directories
    mkdir /home/$USER/docker/mariadb -p && mkdir /home/$USER/docker/owncloud -p
    # set owner of working directories
    sudo chown "$USER":"$USER" /home/"$USER"/docker -R
    # create owncloud network
    docker network create owncloud
    # run the mariadb docker container
    docker run -d --name mariadb --network owncloud --network-alias db -e MYSQL_ROOT_PASSWORD=r00tp@ss -e MYSQL_USER=owncloud_rw -e MYSQL_PASSWORD=OwnCl0ud! -e MYSQL_DATABASE=owncloud -v /home/$USER/docker/mariadb:/var/lib/mysql --restart=unless-stopped mariadb:latest
    # run the owncloud docker container
    docker run -d --name owncloud --network owncloud -p 8080:80 -v /home/$USER/docker/owncloud:/var/www/html --restart=unless-stopped owncloud:latest
  2. Open a web browser and navigate to http://DNSorIP:8080
  3. The Owncloud setup screen should be displayed
  4. Enter a username and password
  5. Click the storage & database link to expand the section
  6. Select MySQL and fill out the database connetion information as follows

    username: owncloud_rw
    password: OwnCl0ud!
    database name: owncloud
    database host: db

  7. Click Finish Setup
  8. After a few moments of setup Owncloud will be up and running
  9. Login with the username and password created a moment ago